let and strict mode

Yehuda Katz wycats at gmail.com
Sun Nov 18 09:26:29 PST 2012


Question: does requiring strict mode for changes that break compatibility
with ES5 really address the 1JS concerns? We're making usages of the
identifier let that were valid in ES5 strict invalid in ES6 strict. Doesn't
that violate 1JS?


On Sun, Nov 18, 2012 at 7:02 AM, Kevin Smith <khs4473 at gmail.com> wrote:

>
>
> Dave Herman proposed as part of 1JS that module imply strict mode, so let
>> is reserved in module. So that helps.
>>
>
> Sure, for inline modules.  But are externally loaded modules strict as
> well?  I think they should be...
>
> 1. 'let' only in strict code including modules per 1JS as originally
>> proposed.
>>
>> 2. 'let' followed by identifier or { but not LineTerminator.
>>
>> 3. 'let' followed by identifier or { with LineTerminator and other space
>> allowed in between.
>>
>> 4. 'let' followed by identifier, {,  or [ and LineTerminator in between
>> is ok.
>>
>> 5. We could also allow 'let' per (4) in functions not in modules that do
>> not "use strict" but do use new ES6 syntax in their heads, e.g.
>> destructuring parameters, default parameters, rest parameters. Those head
>> features could arguably opt into 'let' syntax but not strict mode.
>>
>
> Anything other than (1) neuters either the let statement or let
> identifiers - yuck.  As Domenic says, most new code will go in modules
> anyway.
>
> - Kevin
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
Yehuda Katz
(ph) 718.877.1325
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121118/ab3a80c2/attachment.html>


More information about the es-discuss mailing list