Re: const initializers: once more unto the breach

2012-03-22 Thread Andreas Rossberg
On 21 March 2012 20:05, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Mar 21, 2012, at 10:11 AM, Brendan Eich wrote: Andreas Rossberg wrote: Right, but my comment was only about checking of assignments to const variables. Those are always an error, regardless of TDZ behaviour.

Re: const initializers: once more unto the breach

2012-03-22 Thread Brendan Eich
Allen Wirfs-Brock wrote: On Mar 21, 2012, at 10:11 AM, Brendan Eich wrote: Andreas Rossberg wrote: Right, but my comment was only about checking of assignments to const variables. Those are always an error, regardless of TDZ behaviour. Agreed, absolutely. In all-strict code we know

Re: const initializers: once more unto the breach

2012-03-22 Thread Allen Wirfs-Brock
On Mar 22, 2012, at 9:10 AM, Brendan Eich wrote: Allen Wirfs-Brock wrote: On Mar 21, 2012, at 10:11 AM, Brendan Eich wrote: Andreas Rossberg wrote: Right, but my comment was only about checking of assignments to const variables. Those are always an error, regardless of TDZ

Re: const initializers: once more unto the breach

2012-03-21 Thread Andreas Rossberg
On 20 March 2012 21:46, Allen Wirfs-Brock al...@wirfs-brock.com wrote: It is an open issue whether an implementation should be permitted/required/forbidden to report the statically detectable cases as early errors. The obvious and (and IMO right) rule is that static checks should be required

Re: const initializers: once more unto the breach

2012-03-21 Thread Brendan Eich
There are still temporal dead zone cases that can't be statically analyzed -- at least not without an aggressive higher-order control flow analysis, and even then analysis is approximate so we'd have to mandate false positives or bail to dynamic checks. Isn't the issue that strict mode would

Re: const initializers: once more unto the breach

2012-03-21 Thread Andreas Rossberg
On 21 March 2012 17:47, Brendan Eich bren...@mozilla.org wrote: There are still temporal dead zone cases that can't be statically analyzed -- at least not without an aggressive higher-order control flow analysis, and even then analysis is approximate so we'd have to mandate false positives or

Re: const initializers: once more unto the breach

2012-03-21 Thread Brendan Eich
Andreas Rossberg wrote: Right, but my comment was only about checking of assignments to const variables. Those are always an error, regardless of TDZ behaviour. Agreed, absolutely. In all-strict code we know all the bindings, we see all assignments. /be

const initializers: once more unto the breach

2012-03-21 Thread Andy Wingo
Hello, Unifying the specifications of let and const in the latest draft means that now, const statements can have no initializer. Is that intended? Beyond that, const is just a bit strange. For example: (function (){ baz = 20; return baz; const baz = 30; baz = 40;

Re: const initializers: once more unto the breach

2012-03-21 Thread Allen Wirfs-Brock
On Mar 21, 2012, at 10:11 AM, Brendan Eich wrote: Andreas Rossberg wrote: Right, but my comment was only about checking of assignments to const variables. Those are always an error, regardless of TDZ behaviour. Agreed, absolutely. In all-strict code we know all the bindings, we see all

Re: const initializers: once more unto the breach

2012-03-20 Thread Andy Wingo
On Tue 20 Mar 2012 16:45, Andy Wingo wi...@igalia.com writes: Unifying the specifications of let and const in the latest draft means that now, const statements can have no initializer. Is that intended? Of course, after sending this mail, I find: Static Semantics: Early Errors

Re: const initializers: once more unto the breach

2012-03-20 Thread Allen Wirfs-Brock
On Mar 20, 2012, at 8:55 AM, Andy Wingo wrote: On Tue 20 Mar 2012 16:45, Andy Wingo wi...@igalia.com writes: Your original post doesn't seem to have made it to the discussion list. Unifying the specifications of let and const in the latest draft means that now, const statements can have

Re: const initializers: once more unto the breach

2012-03-20 Thread Andy Wingo
On Tue 20 Mar 2012 21:13, Allen Wirfs-Brock al...@wirfs-brock.com writes: On Mar 20, 2012, at 8:55 AM, Andy Wingo wrote: On Tue 20 Mar 2012 16:45, Andy Wingo wi...@igalia.com writes: Your original post doesn't seem to have made it to the discussion list. Odd. Here's the meat:

Re: const initializers: once more unto the breach

2012-03-20 Thread Allen Wirfs-Brock
On Mar 20, 2012, at 1:23 PM, Andy Wingo wrote: On Tue 20 Mar 2012 21:13, Allen Wirfs-Brock al...@wirfs-brock.com writes: On Mar 20, 2012, at 8:55 AM, Andy Wingo wrote: On Tue 20 Mar 2012 16:45, Andy Wingo wi...@igalia.com writes: Your original post doesn't seem to have made it to

Re: const initializers: once more unto the breach

2012-03-20 Thread Andy Wingo
On Tue 20 Mar 2012 21:46, Allen Wirfs-Brock al...@wirfs-brock.com writes: (function (){ baz = 20; return baz; const baz = 30; baz = 40; baz = 50; })() = 20 no, throws on baz=20; because assignment to an immutable binding Ah, I