W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2011

Re: [WebIDL] Simplify callbacks

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 15 Dec 2011 03:21:43 +0000 (UTC)
To: Cameron McCormack <cam@mcc.id.au>
cc: "public-script-coord@w3.org" <public-script-coord@w3.org>, Anne van Kesteren <annevk@opera.com>
Message-ID: <Pine.LNX.4.64.1112150317530.26122@ps20323.dreamhostps.com>
On Thu, 15 Dec 2011, Cameron McCormack wrote:
> * you can store data on the object and have multiple callbacks using 
> that same object, so that they can all share the same state easily 
> (i.e., there are multiple callback methods on the object)
> If we use "handleEvent" everywhere, then that reduces the usefulness of 
> object-with-property, since you won't be able to use the same 
> handleEvent property as the callback function for different callback 
> types.

I think it's considerably more likely that one would desire to use 
an object of this nature with multiple callbacks of the same type (e.g. 
various different events, or the same callback on various different 
instances of a particular interface) than it is that the same object will 
be used with different callbacks. So if we want to address that use case, 
changing the name is insufficient, while simultaneously having the 
disadvantages I listed in my last e-mail.

> > Don't think of "handleEvent" as meaning "handle a DOM Event object". 
> > Think of it as "handle an event", the event being "the callback was 
> > invoked".
> Yes, we can re-think what the name means like this.

I don't see it as a rethinking of the name. Personally I never even 
realised there could be an interpretation of handleEvent() that referred 
specifically to DOM Event objects until people started saying we should 
call the method with other names. I've used the name HandleEvent in APIs 
for years.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 15 December 2011 03:22:15 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:05 UTC