Newly revised Section 10 for ES3.1.

Brendan Eich brendan at mozilla.org
Thu Jul 10 18:46:07 PDT 2008


On Jul 10, 2008, at 6:01 PM, Waldemar Horwat wrote:

> The key criterion here is whether you can come up with a language  
> that makes sense.  None of the existing behaviors make sense  
> because they would make 'function' hoist differently from 'const'  
> hoist differently from declaring other kinds of things in ES4,  
> etc., with the only way of fixing it being introducing yet more  
> ways of declaring things.  The net result would be gratuitously  
> hostile to everyone in the long term.


Agreed.

On the other hand, Maciej is probably right [1] that a non-trivial  
amount of web content depends on intersection semantics today,  
loading scripts under the default version (no type or else one of the  
version-free javascript types). This is why I think opt-in versioning  
is required to change the meaning of a function definition in a block.

/be

[1] http://bugs.webkit.org/show_bug.cgi?id=13790 is about a script at  
starcraft2.com that once looked like this:

     if (ie||ns6)
     //var tipobj =  document.getElementById("dhtmltooltip");

     function ietruebody(){

Someone carelessly commented out the consequent, making the if (ie|| 
ns6) govern the definition of function ietruebody without bracing  
that definition. In no proposed ES3.1 or ES4 would this be legal.  
Anyway, the error has since been fixed, and last I looked, the page  
did this:

     //if (ie||ns6)
     //var tipobj =  document.getElementById("dhtmltooltip");

     function ietruebody(){

See view-source:http://www.starcraft2.com/js/tooltip.js.

I'm interested in learning of more sites that seem to depend on  
intersection semantics. Please post URLs to the lists.



More information about the Es4-discuss mailing list