Re: [websockets] Getting WebSockets API to Last Call

On Mon, Jul 11, 2011 at 11:36 AM, Ian Hickson <ian@hixie.ch> wrote:
> On Mon, 11 Jul 2011, Marcos Caceres wrote:
>> On 7/11/11 8:23 PM, Ian Hickson wrote:
>> > On Mon, 11 Jul 2011, Jonas Sicking wrote:
>> > > On Mon, Jul 11, 2011 at 11:04 AM, Ian Hickson<ian@hixie.ch>  wrote:
>> > > > On Fri, 8 Jul 2011, Jonas Sicking wrote:
>> > > > >
>> > > > > On the other hand, we should [not] do things now that are likely to
>> > > > > create a more complicated or inconsistent platform in the future.
>> > > >
>> > > > I agree, indeed that's my main reason for not wanting to make objects
>> > > > inherit from EventTarget. :-)
>> > >
>> > > I think adding EventTarget to the chain is a simplification as it makes
>> > > that interface more consistent with the majority of other ones.
>> >
>> > I mean in general, on any interface.
>> >
>> > IMHO nothing should inherit from EventTarget. That some interfaces do in
>> > the specs today is a relatively new development and IMHO one that will
>> > complicate the platform in the future.
>>
>> Interesting. How so? Do you have an example where inheriting from
>> EventTarget has become an issue or is going to be an issue? I personally
>> don't have a position on this, I'm just really interested because I had
>> this come up in other (proprietary) contexts.
>
> Why is EventTarget special?
>
> If one day we decide that many objects should all implement something
> else, e.g. a Clonable interface or something, what do we do?

Then we'll add Clonable as a mixin at that time. Similar to what we'd
do if we have some interface that we only want to apply to some
HTMLElements (such as all form controls, or all "sectioning"
elements).

Adding EventTarget as a base interface is only a bad idea if there
appears in the future an interface which is more widely inherited than
EventTarget and more widely used than EventTarget. This seems highly
unlikely to me given how widely used and inherited EventTarget is.

EventTarget is no different from Node. Node supplies the ability to
take part in the document tree, EventTarget supplies the ability to
receive events.

/ Jonas

Received on Thursday, 14 July 2011 00:27:57 UTC