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.
* It deoptimizes, e.g. a strict-mode function must be optimized to copy
actual parameter values into arguments if it could use the arguments object.
Leave non-strict as is, and let users opt-in to "let". An excellent
carrot.
The problem is precisely that users cannot opt into "let" alone by its
novel syntax. Opting into strict mode may or may not win but it has
added costs and benefits, and that means let adoption will suffer.
1JS wants new syntax to be its own opt-in. The only issue with making
let work in non-strict code is the obscure let[i] = j; pattern. If no
one actually wrote such code (it's possible; public web searches by big
search-engine companies, or at least one so far, found nothing), then we
should not risk reduced let adoption by yoking it to the heavier burden
of strict mode.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss