Closed
Bug 855665
Opened 10 years ago
Closed 8 years ago
Enable let without version=1.7+
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: evilpie, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: meta)
We probably should implement the new yield parsing for that first. In a next step we should see if we can remove all the version number crap.
yield works now, but let still doesn't. CCing Wingo who was the one to fix yield. Wanna give 'let' the same love?
Comment 2•10 years ago
|
||
I don't have time to do this unfortunately. Also it's quite a tricksy project :) Best of luck to the hacker that takes this bug!
Summary: Enable let and yield without version=1.8 → Enable let without version=1.8
Comment 3•10 years ago
|
||
Honestly I have no idea how it's expected to enable |let| for all JS. Every time it's been tried -- by us once or twice, by JSC once, maybe others -- it's foundered on web-compatibility rocks. Unless we want to switch and actively evangelize sites not to use |let| as a variable name -- and our track record of evangelizing rather than backing out worthy changes is abysmal -- I think this is doomed.
Has someone raised this with TC39? AFAIK it's in the spec. I think it's limited to only strict mode, but I don't know if that makes a difference compatibility-wise.
Comment 5•10 years ago
|
||
I'm similarly pessimistic. In any case it is possible to enable let within strict mode, though.
Actually, given that 'let' is *already* a reserved word in gecko in strict mode, I see no problems with enabling it there? Am I missing something?
Comment 7•10 years ago
|
||
TC39 should be aware. Our people there are aware of such experiments, olliej there is as well. Not to be too jaundiced about it, but I think they're in the let's-pretend-we-can-la-la-la-and-maybe-things-will-change-eventually mindset. Which, honestly, isn't entirely crazy, just enough that I would bet against it. There are perhaps no reasons we couldn't enable let in strict mode, except that TC39 doesn't really like strict mode much, and in their (also perhaps jaundiced) view, basically nobody uses it, and thus it doesn't really matter what's done there. But others who have paid closer attention to TC39 recently may have more informed views of the question.
Comment 8•10 years ago
|
||
I'd be happy to use let if it was available … We just have a chicken-egg problem ATM, and I'd very much appreciate if let were available in strict mode at least (that allows developers to get comfortable with it, even if it is not available in non-strict mode for now!). As most ES6 syntax triggers strict mode, the "user base" for let will grow soon enough. If and when let will be available for non-strict mode, can be decided at later point (though it's definitely preferable to not fragment the web more). And maybe, within a year or two, the legacy-let-problem will be solved by itself, so we can enable let in non-strict without breaking legacy code.
Comment 9•10 years ago
|
||
Is our let the same let as TC39 let?
Comment 10•10 years ago
|
||
According to MDN, it's not block-local yet (which TC39 let is).
Reporter | ||
Comment 11•10 years ago
|
||
I am pretty sure it is block local. Test this: { let a = 5; } alert(a) The major difference that I know of is bug 589199.
Comment 12•10 years ago
|
||
Also the (In reply to :Ms2ger from comment #9) > Is our let the same let as TC39 let? AFAIK, no. ES6 let has a temporal dead zone. In SM: js> (() => { let f = () => b, a = f(), b = 1; return [a, b]; })() [(void 0), 1] whereas the reference to b before assignment should raise an error.
Comment 13•10 years ago
|
||
(In reply to Jeff Walden [:Waldo] (remove +bmo to email) from comment #3) > Honestly I have no idea how it's expected to enable |let| for all JS. Every > time it's been tried -- by us once or twice, by JSC once, maybe others -- > it's foundered on web-compatibility rocks. Could the JS parser distinguish between |let| the keyword and a variable name, depending on context? let let = ":)"; (In reply to Andy Wingo [:wingo] from comment #12) > Also the (In reply to :Ms2ger from comment #9) > > Is our let the same let as TC39 let? > > AFAIK, no. ES6 let has a temporal dead zone. In SM: Is there a bug to implement ES6 let's temporal dead zone? I can't find one.
Comment 14•10 years ago
|
||
(In reply to Chris Peterson (:cpeterson) from comment #13) > Could the JS parser distinguish between |let| the keyword and a variable > name, depending on context? > > let let = ":)"; It really should be raised on TC39, rather than introducing yet another SM quirk.
Comment 15•10 years ago
|
||
(In reply to comment #13) > Could the JS parser distinguish between |let| the keyword and a variable name, > depending on context? > > let let = ":)"; No. let[x] = [42]; Destructuring declaration of |x|? Or assignment to the property named by |p| on the global property |let|? Of course, you could try to sub-distinguish to exclude that case somehow...or something. But it seems to me pretty dangerous or so to try to be too fine-grained about it, just in terms of language aesthetics and web developer sanit and all that.
Comment 16•10 years ago
|
||
(In reply to Jeff Walden [:Waldo] (remove +bmo to email) from comment #7) > TC39 should be aware. Our people there are aware of such experiments, > olliej there is as well. Not to be too jaundiced about it, but I think > they're in the > let's-pretend-we-can-la-la-la-and-maybe-things-will-change-eventually > mindset. Which, honestly, isn't entirely crazy, just enough that I would > bet against it. Here are is the discussion for reference: https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-11/nov-29.md#the-syntax-of-let > > There are perhaps no reasons we couldn't enable let in strict mode, except > that TC39 doesn't really like strict mode much, If you have been keeping up with the notes[0] that I've published since May 2012, you'd know this isn't true at all. > and in their (also perhaps > jaundiced) view, basically nobody uses it, and thus it doesn't really matter > what's done there. Again, this is false. The committee believes that strict mode will eventually be the only mode. New scoped binding forms are all strict by default now (eg. class body and module body). > But others who have paid closer attention to TC39 > recently may have more informed views of the question. [0]https://github.com/rwaldron/tc39-notes
Comment 17•10 years ago
|
||
OK the notes say `let` for strict mode, no `let` for non-strict. Can somebody change the summary then, please?
Comment 18•10 years ago
|
||
(In reply to Rick Waldron [:rwaldron][:rick][:rick waldron] from comment #16) > > Here are is the discussion for reference: > https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-11/nov-29.md#the- > syntax-of-let Rick: Do your 2012-11 meeting notes in comment 16 reflect the committee's current thinking about let? If so, then we can implement let in strict mode and non-strict mode (with single token lookahead). TL;DR: LH: A search of indexed web reveals 3 uses of var let. ... Conclusion/Resolution In non-strict code: let, with single token lookahead (where the single token is either an Identifier, "[", or "{" ), at the start of a statement is a let declaration. (Accepted breaking change)
Keywords: feature
Comment 19•10 years ago
|
||
(In reply to Florian Bender from comment #17) > OK the notes say `let` for strict mode, no `let` for non-strict. Can > somebody change the summary then, please? I suspect you misread the notes. `let` in strict code is a non-issue, because `let` is reserved in strict code. The committee agreed to move forward with `let` in non-strict code, b/w a lookahead: https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-11/nov-29.md#conclusionresolution-6 (In reply to Chris Peterson (:cpeterson) from comment #18) > (In reply to Rick Waldron [:rwaldron][:rick][:rick waldron] from comment #16) > > > > Here are is the discussion for reference: > > https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-11/nov-29.md#the- > > syntax-of-let > > Rick: Do your 2012-11 meeting notes in comment 16 reflect the committee's > current thinking about let? If so, then we can implement let in strict mode > and non-strict mode (with single token lookahead). > > TL;DR: > > LH: A search of indexed web reveals 3 uses of var let. > > ... > > Conclusion/Resolution > > In non-strict code: let, with single token lookahead (where the single > token is either an Identifier, > "[", or "{" ), at the start of a statement is a let declaration. (Accepted > breaking change) Yes, this remains the current consensus and is not likely to change before January 1, 2014. I'm going to follow up with Allen re: spec draft coverage.
Comment 20•10 years ago
|
||
In rev20 of ES6 Draft: 13.4 Expression Statement Syntax ExpressionStatement[yield] : [lookahead ∉ {{, function, class, let [ }] Expression[in, ?yield] ; I'm reopening the spec bug because `let {` is missing
Comment 21•10 years ago
|
||
(In reply to Rick Waldron [:rwaldron] from comment #19) > (In reply to Florian Bender from comment #17) > > OK the notes say `let` for strict mode, no `let` for non-strict. Can > > somebody change the summary then, please? > > > I suspect you misread the notes. `let` in strict code is a non-issue, > because `let` is reserved in strict code. The committee agreed to move > forward with `let` in non-strict code, b/w a lookahead: > https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-11/nov-29. > md#conclusionresolution-6 I'm sorry, my comment was a bit unclear. AFAIU, `let` for strict mode can be implemented right away, while it is okay to delay `let` for non-strict mode. That's what I thought this bug should be about now (thus not covering `let` for non-strict, and do that in a follow up). Did I get that correctly?
Comment 22•10 years ago
|
||
I filed blocking bug 932513 ("Enable let without version=1.8 in strict mode") and bug 932517 ("Enable let without version=1.8 in non-strict mode"). Separate bugs for separate issues. :)
Comment 23•10 years ago
|
||
(In reply to Florian Bender from comment #21) > (In reply to Rick Waldron [:rwaldron] from comment #19) > > (In reply to Florian Bender from comment #17) > > > OK the notes say `let` for strict mode, no `let` for non-strict. Can > > > somebody change the summary then, please? > > > > > > I suspect you misread the notes. `let` in strict code is a non-issue, > > because `let` is reserved in strict code. The committee agreed to move > > forward with `let` in non-strict code, b/w a lookahead: > > https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-11/nov-29. > > md#conclusionresolution-6 > > I'm sorry, my comment was a bit unclear. AFAIU, `let` for strict mode can be > implemented right away, while it is okay to delay `let` for non-strict mode. > That's what I thought this bug should be about now (thus not covering `let` > for non-strict, and do that in a follow up). > > Did I get that correctly? I can't really comment on the implementation strategy for ES6 features in SM, but I trust that those of you working directly on such things know the best path forward there. I'm just trying to provide clarity on behalf of the committee. A more important concern for me is that `let` and `const` are implemented correctly and IIRC, the impl in version=1.8 is not aligned with ES6's temporal deadzone semantics.
Comment 24•10 years ago
|
||
`const` is even worse in that regard, as it is not even block scoped.
Assignee | ||
Updated•9 years ago
|
Assignee: general → nobody
Comment 26•8 years ago
|
||
let is currently available in javascript;version=1.7 and 1.8.
Summary: Enable let without version=1.8 → Enable let without version=1.7+
Reporter | ||
Comment 27•8 years ago
|
||
Fixed by bug 932517.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•