Re: [Bindings] extended attribute for callback function interfaces?

On Wed, 17 Oct 2007, L. David Baron wrote:
> 
> There are a number of interfaces, used as callbacks, like EventListener 
> [1], NodeFilter [2], and UserDataHandler [3], and XPathNSEventResolver 
> [4] where an interface has a single method and is intended to be 
> implemented by the DOM user as a callback.  In ECMAScript bindings, the 
> implementation typically accepts a raw function for such cases, in 
> addition to (or rather than, in some implementations, perhaps?) an 
> object with a named property for the function.
> 
> Should there be an extended attribute to indicate such interfaces? (I'd 
> note that Mozilla's IDL has such an extended attribute, [function].)

Well that's freaky, we were just talking about this very thing earlier 
today in the #webapi channel.

Our conclusion was that we would like a way to mark an interface as 
being a callback and thus implementable as a function, with the interface 
having one method, that method defing the signature of the function. Such 
interfaces should, in addition, not be exposed on the global object in JS.

(I personally would like something even further, I'd love to just be able 
to put the callback signature right in the method:

   void callMeBack(in [Arguments=in long value, in bool active] Callback callback);

...or some such. That would get around having to actually define each of 
these interfaces, which is becoming a right pain in the neck for me over 
in the HTML5 spec. However, I don't think we need this in the Bindings 
spec, I can just define a preprocessor step for this for myself.)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 18 October 2007 05:12:36 UTC