Re: lexical for-in/for-of loose end

2012-02-07 Thread Andy Wingo
Hi Allen, On Mon, 2012-02-06 at 11:08 -0800, Allen Wirfs-Brock wrote: We're putting a lot of energy into trying to figure out how to fix for(let;;) when it probably shouldn't even be the preferred form of numeric looping going forward. If we can make for-in/for-of attractive enough then it is

Re: lexical for-in/for-of loose end

2012-02-07 Thread Herby Vojčík
Brendan Eich wrote: Grant Husbands wrote: * Both of them make closures in the init and in the rest see a consistent world, for as long as is possible, while still giving body closures unique copies per iteration. Is there any inconsistency observable after as long as possible? I can't find

Re: lexical for-in/for-of loose end

2012-02-07 Thread Herby Vojčík
Allen Wirfs-Brock wrote: With body-swap it concerns me a bit that is an arbitrary and variable number of closures may need to be updated each iteration (consider a body containing a while loop that spits out closures that capture init bindings.) I think there are some lazy possibilities for

Re: lexical for-in/for-of loose end

2012-02-07 Thread Andreas Rossberg
On 6 February 2012 21:03, Herby Vojčík he...@mailbox.sk wrote: Well, in fact what I proposed was not changing the behaviour of head-closures, but body-closures. Basically, the idea was: let the loop run in legacy semantics (only one block for the whole for-loop). All closures (head ones and

RE: lexical for-in/for-of loose end

2012-02-07 Thread Domenic Denicola
This seems like a highly compelling argument. I hope I'm not the only one who thinks the existing behavior of `for(;;)` makes sense. Granted, that comes from understanding the detail that closures close over variables and not values, which most users will not. But in general, `for(;;)` makes it

Re: lexical for-in/for-of loose end

2012-02-07 Thread Grant Husbands
On 7 February 2012 13:32, Andreas Rossberg rossb...@google.com wrote: What are the closures that were created, They are the closures that lie lexically within the loop's code, outside of the init, (or, put differently, those that have the loop's environment record in scope) and that were

Re: Nested Quasis

2012-02-07 Thread Erik Arvidsson
On Mon, Feb 6, 2012 at 18:49, Mark S. Miller erig...@google.com wrote:     QuasiHole ::         Identifier         { Spacing* (BalancedCurlySequence Spacing*)* } If you replace that with:     QuasiHole ::         Identifier         { Spacing* Expression Spacing* } You can now support nested

Re: Nested Quasis

2012-02-07 Thread Erik Arvidsson
On Mon, Feb 6, 2012 at 18:49, Mark S. Miller erig...@google.com wrote:     QuasiChar ::         SourceCharacter but not one of $ or `         $ $         $ `         $ \ EscapeSequence This part was never in the Quasi proposal. `abc$$def` is the same as `abc\${def}` according to the current

Re: lexical for-in/for-of loose end

2012-02-07 Thread Andreas Rossberg
On 7 February 2012 15:40, Grant Husbands esdisc...@grant.x43.net wrote: On 7 February 2012 13:32, Andreas Rossberg rossb...@google.com wrote: What should the following do? let a = [], b = [], c = [], d = [] for (int i = 0, f = function(){ return function() { ++i } }; i 10; d[i] = function()

Globalization API: Prototype objects

2012-02-07 Thread Norbert Lindenberg
The current specification of the ECMAScript Globalization API requires the prototype objects for the LocaleList, Collator, NumberFormat, and DateTimeFormat constructors to be objects constructed by these constructors themselves. This is following a pattern established in the ECMAScript Language

Re: Globalization API: Prototype objects

2012-02-07 Thread Allen Wirfs-Brock
On Feb 7, 2012, at 10:27 AM, Norbert Lindenberg wrote: The current specification of the ECMAScript Globalization API requires the prototype objects for the LocaleList, Collator, NumberFormat, and DateTimeFormat constructors to be objects constructed by these constructors themselves.

Explicit local copies (was: Re: lexical for-in/for-of loose end)

2012-02-07 Thread Herby Vojčík
Andreas Rossberg wrote: let a = [], b = [], c = [], d = [] for (int i = 0, f = function(){ return function() { ++i } }; i 10; d[i] = function() { return i }, ++i) { a[i] = f; b[i] = f(); c[i] = function(){ return i } } But note that the environment in b's closures is not the for-loop

Re: lexical for-in/for-of loose end

2012-02-07 Thread Grant Husbands
Andreas Rossberg wrote: let a = [], b = [], c = [], d = [] for (int i = 0, f = function(){ return function() { ++i } }; i 10; d[i] = function() { return i }, ++i) {  a[i] = f;  b[i] = f();  c[i] = function(){ return i } } But note that the environment in b's closures is not the for-loop

Re: Nested Quasis

2012-02-07 Thread Waldemar Horwat
On 02/06/2012 06:49 PM, Mark S. Miller wrote: On Mon, Feb 6, 2012 at 3:26 PM, Waldemar Horwat walde...@google.com mailto:walde...@google.com wrote: On 02/03/2012 08:07 PM, Mark S. Miller wrote: On Fri, Feb 3, 2012 at 12:58 PM, Waldemar Horwat walde...@google.com

Re: Nested Quasis

2012-02-07 Thread Erik Arvidsson
Correction... This part was never in the Quasi proposal. `abc$$def` is the same as `abc\${def}` according to the current proposal. `abc\$${def}` The point is that only $ident and ${...} are special. In all other contexts, $ is a normal character. -- erik

Re: Nested Quasis

2012-02-07 Thread Mark S. Miller
On Tue, Feb 7, 2012 at 9:48 AM, Erik Arvidsson erik.arvids...@gmail.comwrote: On Mon, Feb 6, 2012 at 18:49, Mark S. Miller erig...@google.com wrote: QuasiHole :: Identifier { Spacing* (BalancedCurlySequence Spacing*)* } If you replace that with: QuasiHole ::

Re: Nested Quasis

2012-02-07 Thread Mark S. Miller
To reiterate, my posts here are expository, to explain how I approached these same matters in E, to see if that helps resolve any remaining controversy. Regarding what we're actually proposing, I'll let Mike speak for that. On Tue, Feb 7, 2012 at 9:56 AM, Erik Arvidsson

Re: Nested Quasis

2012-02-07 Thread Waldemar Horwat
On 02/07/2012 02:51 PM, Mark S. Miller wrote: On Tue, Feb 7, 2012 at 1:52 PM, Waldemar Horwat walde...@google.com mailto:walde...@google.com wrote: [...] That's going back to the previous approach of treating the whole quasi as a single token. This doesn't work because it's not possible

Re: Nested Quasis

2012-02-07 Thread Mark S. Miller
On Tue, Feb 7, 2012 at 3:47 PM, Waldemar Horwat walde...@google.com wrote: [...] To illustrate the problem, consider a simpler lexer rule: TokenSequence :: Token* This will lex ainb as many things, including for example a in b. I now understand your objection. Rather than trying to

Re: Nested Quasis

2012-02-07 Thread Brendan Eich
I like Erik's way, but it makes a strange loop from lexical to syntactic grammar. It all works, I believe. The loop is here: QuasiHole :: Identifier { Spacing* Expression Spacing* } Expression is a syntactic grammar non-terminal, yet here we are in a lexical production.