Re: [WebIDL] Simplify callbacks

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