On Mar 10, 2011, at 7:18 PM, Brendan Eich wrote:

> Harmony is *not* a clean break. I don't know why you wrote that.

Perhaps Charles meant "a clean break in for-in semantics".

That's what I propose via my index-finger compatibility break:


> Harmony has some room to break compatibility, especially if the old forms are 
> caught by early errors. I've spoken of one hand's worth of fingers to count 
> these breaks (the "five fingers of fate"). The valuable and opposable thumb 
> is for removing the global object from the scope chain. The index finger on 
> my hand is paren-free relaxation of syntax combined with better for-in 
> semantics.

The idea (http://brendaneich.com/2010/11/paren-free/, followups in 
http://brendaneich.com/2011/01/harmony-of-my-dreams/) is to relax the grammar 
so that parentheses may be omitted from statement heads where the parenthesized 
form is an expression, but to remove parens around the for loop heads (a la Go, 
for the three-part for ;; head). This requires that the body or then-clause be 
braced unless it is a simple statement that starts with an unconditionally 
reserved identifier.

The benefit for code migration is that for (x in o) ...; code will not compile 
in such a Harmony. Migrators will have to rewrite and (if necessary) choose a 
custom iterator to get the desired order and values or keys: for x in keys(o) 
{...;}, e.g. where keys is imported from a standard enumerators module.

This is less likely to break code than a subtle, runtime-only, and therefore 
"unclean" break in the meaning of for (x in o).

/be

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to