Comments on Meeting Notes

Claude Pache claude.pache at gmail.com
Wed Dec 5 09:02:30 PST 2012


Le 5 déc. 2012 à 15:28, Brendan Eich <brendan at mozilla.org> a écrit :

> Claude Pache wrote:
>> Le 4 déc. 2012 à 22:28, Brendan Eich<brendan at mozilla.org>  a écrit :
>> 
>>> Mark S. Miller wrote:
>>>> On Tue, Dec 4, 2012 at 10:48 AM, Brendan Eich<brendan at mozilla.org>   wrote:
>>>>> Kevin Smith wrote:
>>>>>> I recommend allowing let declarations only in strict mode.  This is the
>>>>>> simple, backwards-compatible path.  Strict mode only has a bad reputation
>>>>>> because, in ES5, it is restrictive-only.  There are (almost) no carrots
>>>>>> leading users there.
>>>>> Strict mode has a bad rep for two other important causes:
>>>>> 
>>>>> * It forks runtime semantics, which requires careful testing in
>>>>> pre-ES5-strict implementations. This has been a real-world problem, multiple
>>>>> times.
>>>> I buy this for old code that needs to just keep working, bugs and all,
>>>> without human attention. But strict mode can be opted into
>>>> incrementally, per program or even per function.
>>> Real world problem: concatenation.
>>> 
>> 
>> If we allow "let" and destructuring assignment in non-strict mode,
> 
> (I'm not sure why anything I wrote about strict mode problems was cited, since you did not repond to the "strict mode has a bad rep for these reasons" points...)
> 
(I was probably responding to the wrong message of this thread, sorry.)

>>  a
>> developer will happily use "let" as variable name, then one day they
>> will write "let[i] = j" (Murphy's law), and get an incomprehensible
>> failure.
> 
> This could happen, but did the developer forget to declare "let" (assign an implicit global)? The odds shrink. All uses of 'let' as an identifier have abbreviated "letter" and stored a unit-length string value, so have not indexed into the value.
"Iet" as abbreviation of "letter", yes ; or maybe some Norwegian developer has once used "let" as an array of colour values? (see http://en.wiktionary.org/wiki/let ), I don't know.
> 
> We talked about making 'var let' in combination with 'let[i] = j' an error, but we did not want parsing to depend on binding. OTOH we did talk about warnings.
> 
If we have indeed warnings when using "let" as identifier, it mitigates the problem. And I think it is a must, for the proposed interpretation of  "var let = []; let[i]=j" is really awkward and bizarre (from a human POV).

> Murphy's Law does govern us, I agree. It says that anything that can go wrong, will go wrong. But this applies to let underutilization if yoked to strict mode. Deciding between the alternative paths is not a matter of simple logic, since it depends on human factors.
> 
> /be
(I guess that "let" will be underused anyway in the next six or eight years, because the small value it brings is not worth the cost of being incompatible with older browsers.)

Claude


More information about the es-discuss mailing list