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

Re: [WebIDL] Simplify callbacks

From: Cameron McCormack <cam@mcc.id.au>
Date: Thu, 10 Nov 2011 15:55:52 +1100
Message-ID: <4EBB5958.3060302@mcc.id.au>
To: David Flanagan <dflanagan@mozilla.com>
CC: Olli Pettay <Olli.Pettay@helsinki.fi>, Brendan Eich <brendan@mozilla.org>, public-script-coord@w3.org
On 9/11/11 10:38 AM, David Flanagan wrote:
> Given the current WebIDL syntax, I agree that =FunctionOnly should
> probably be removed. But Anne has proposed an alternative syntax that
> changes things pretty radically. Under that new syntax, I think it is
> worth trying to force all new callbacks to be functions rather than
> trying to hold on to Java-style interface objects.

When we discussed [Callback=FunctionOnly] at TPAC last week, it seemed 
everyone in the room at least was happy with dropping "=FunctionOnly" 
from Web IDL, making everything implicitly allow objects with 
handleEvent or whatever other property name, so that DOM APIs would be 
consistent in allowing objects as well as functions.  Plus it prevents 
authors of new specs from selecting whether objects are accepted just 
based on their personal preference.

I sympathise with the view that { handleEvent: ... } seems 
un-JavaScripty, and that you can get the same effect if you want it by 
using bind().

(I think we've discussed this all before, though.)

> If spec authors (and spec consumers) still have to deal with callback
> interface definitions that define different method names for different
> callback types, then it doesn't seem to me that there is much point in
> Anne's proposal.

I agree with that.
Received on Thursday, 10 November 2011 04:56:33 UTC

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