[whatwg] ECMAScript extensions in Web Applications

Ian Hickson ian at hixie.ch
Thu May 24 12:47:39 PDT 2007


On Wed, 19 Oct 2005, Krzysztof Maczynski wrote:
> >
> > Are you suggesting that any Function object should have a 
> > .handleEvent() method in addition to its .call() method and its 
> > .prototype attribute? What would be the point?
>
> Consistency. The exceptional treatment for ECMAScript described in the 
> WD is:
> 
> 1) Not merely a language binding feature. It's another DOM for another 
> language. Variability from language to language is acceptable but 
> differences should be justified. Let me describe an ideal situation. In 
> my opinion it would be when a translator whose input language is X and 
> output language is Y didn't need any knowledge of the extensions. 
> Generic, purely syntactic rules for rewriting names of host objects, 
> methods etc. should be enough.
> 
> 2) A simplification for implementors, not requiring features not 
> currently implemented, and possible to do without when ECMAScript-only, 
> error-free, only to be run and not inspected, applications written in 
> Notepad are concerned. Since this simplification only works in languages 
> where functions are first-class objects, you mandate its use in 
> ECMAScript only (possibly with particular implementations: JavaScript, 
> JScript). If being able to declare current browsers compliant is a 
> highest priority requirement, this is an argument for making this 
> interface explicitly present on functions in such languages (and the 
> spec should say _all_ such languages) not a MUST. Now in the WD it's 
> MUST NOT. The arguments I presented are for making it SHOULD or at the 
> very least MAY.

These arguments don't seem very convincing to me. Adding 'handleEvent' to 
all Functions in all languages with first class Function objects would 
significantly increase the overhead of implementing those languages. 
Indeed, it would mean that the HTML spec was affecting parts of languages 
that have nothing to do with HTML.

It gets even worse when you consider that there are a number of interfaces 
that are interchangeable with Function -- e.g. setTimeout() can take a 
Function-like object.

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



More information about the whatwg mailing list