ES6 doesn't need opt-in
brendan at mozilla.com
Tue Jan 3 15:27:09 PST 2012
On Jan 3, 2012, at 12:28 PM, Gavin Barraclough wrote:
> On Jan 3, 2012, at 12:18 PM, Brendan Eich wrote:
>> Maybe. We tried in 2006-2007 and ran into at least this:
>> where 'yield' was used as a parameter name. I dimly recall 'let' in the wild but may be misremembering. Perhaps out of paranoia we made both 'let' and 'yield' require version opt-in.
>> The site that used 'yield' has since been updated to avoid using 'yield'. So we could try again to reserve 'let' unconditionally. Heaven knows I've been yapping about 'let' as the new 'var' long enough to warn most developers away from it!
>> I discussed this on IRC briefly with Oliver, who seemed game. The only issue I see is that nightly builds (WebKit, Chrome, Firefox) don't get enough use to do other than find true positives. It would be good to find such 'let' usage in the wild, of course, but finding nothing won't give us a green light, just lack of a red light.
> Why unconditionally reserve let? - would it not make more sense to handle this in a contextual fashion if we can do so? – if so, we could introduce 'let' without any backwards compatibility risk, and retain the option to promote it to a keyword at a later date.
You're proposing that we require 'let' be only at the start of statements? If so, then destructuring is problematic:
let [x] = y;
Did that last line destructure the property named '0' of the object denoted by y into a let-bound x, or was it old, pre-ES6 code that stored y into the x'th element of an object denoted 'let'? In either case the 'let' is at the start of a statement.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss