On Jan 16, 2013, at 11:54 AM, Domenic Denicola <[email protected]> 
wrote:

> Coincidentally, I compiled a list of interesting cases a few days ago, for 
> both const and let. They were meant to be used in kangax's ES6 compatibility 
> table:
> 
> https://github.com/kangax/es5-compat-table/issues/58
> 
> In short:
> 
> const x; // SyntaxError
> let x; let x; // SyntaxError
> const x = 5; const x = 5; // SyntaxError
> x; const x = 5; // ReferenceError
> x; let x; // ReferenceError
> const x = 2; { x; const x = 5; } // ReferenceError
> let x; { x; let x; } // ReferenceError
> 
> plus a test of fresh per-loop iteration for let
> 
> Corrections welcome, and kudos to Brandon Benvie on pointing me to the fact 
> that those last four should be ReferenceErrors.

I'm not too interested in what the spec says these should/should not be.  I'm 
interested in what _shipping_ browser engines do.  Presumably IE throws on all 
of them, but we need a nice table for const which is "supported" by multiple 
engines to show the differences in behaviour so that we can determine the best 
intersection.

--Oliver

> 
> ________________________________________
> From: [email protected] [[email protected]] on 
> behalf of Oliver Hunt [[email protected]]
> Sent: Wednesday, January 16, 2013 14:40
> To: Brendan Eich
> Cc: Mark S. Miller; Mark Miller; [email protected]
> Subject: Re: excluding features from sloppy mode
> 
> Even 10?  If that's the case anything using const is inherently tied to 
> jsc,v8,moz,opera behaviour.
> 
> Presumably the strictest of those _works_, but maybe i'm wrong?
> 
> We should probably just enumerate all the differences and see which can be 
> coalesced and which make "sense" in sloppy mode.
> 
> Obvious cases i can think of:
> 
> --
> const x;
> --
> var x;
> const x;
> x = 5;
> --
> const x;
> var x;
> x = 5;
> --
> const x =4;
> var x = 5;
> log(x)
> --
> if (..)
>   const x = ....
> else
>   const x = ....
> --
> 
> That's it for now.  Maybe block scoping const will work in sloppy mode?  is 
> for (const x = ...) valid?
> 
> --Oliver
> 
> 
> 
> On Jan 16, 2013, at 11:31 AM, Brendan Eich <[email protected]> wrote:
> 
>> There's no const in IE, so we are pretty sure we can take the hit of 
>> breaking "Mozilla" (non-IE branches, also WebKit, maybe Opera) code that 
>> uses const.
>> 
>> /be
>> 
>> Brandon Benvie wrote:
>>> The incompatibilities between let/const as implemented in V8 and 
>>> Spidermonkey and how they're specified in ES6 are an additional factor:
>>> 
>>> * Per iteration loop binding (V8 and Spidermonkey don't do this for 
>>> let/const).
>>> * TDZ. `x; const x = 10` works in V8 and Spidermonkey currently, specified 
>>> to throw ReferenceError in ES6
>>> 
>>> I think there's other differences.
> 
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
> 
> 

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to