1js, local fundecls, and not-quite-conforming pre-es6 implementations

Brendan Eich brendan at mozilla.org
Wed Oct 3 22:04:06 PDT 2012

Claus Reinke wrote:
> But with 1JS, I'm no longer sure what happens when new code that
> relies on local FunDecls (and no other ES6 features) encounters an
> old implementation. It looks as if there will be no warning or error,
> just irreconcilable differences in behaviour?

That's the case already, with old code using function declarations in 

Such code typically has the form

   /* A */
   if (B) {
     /* C */
     function D(...) {...}
     /* E */
   /* F */

where only code in /* E */ uses D. Anything else relies on hoisting (not 
done by SpiderMonkey in Firefox) or unconditional binding (in /* F */, 
not done by SpiderMonkey).

So (we hope) the problem is not actually present in portable code. We've 
seen real code like this. See 
https://bugzilla.mozilla.org/show_bug.cgi?id=630851#c8 for details.

> Is the recommendation that local FunDecls should only be used in
> combination with explicit ES6 syntax (to trigger opt-in or explicit
> errors)?

No, that's too restrictive.

> Should this recommendation appear in the spec (the old Note was deleted)?

Probably not, but some kind of NOTE might be appropriate.

> http://clausreinke.github.com/ 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

More information about the es-discuss mailing list