W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2007

[whatwg] ECMAScript extensions in Web Applications

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 24 May 2007 19:47:39 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0705241944270.23432@dhalsim.dreamhost.com>
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.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 24 May 2007 12:47:39 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:55 UTC