On May 24, 2011, at 7:37 AM, Sean Eagan wrote:

> I am definitely a grammar classification noob, so feel free to rake me
> over the coals on this if necessary, but how is :
> 
> var a = {!b};
> 
> ... any more difficult to parse than ...
> 
> var a = {b};
> 
> ... both {b} and {!b} and valid blocks, so it is equally as easy to
> determine that they are object literals instead, and once inside the
> object literal, everything should be peachy I would think.

You're right, this would be unambiguous because a block can't initialize a var. 
The only interpretation is an expression, which with Allen's proposal combined 
with object intiialiser shorthand would parse {!b}.

So that's ok -- sorry for over-reacting.

What I'm concerned about is the attempt, precipitated by a suggestion from Doug 
Crockford, to parse block or object initialiser unambiguously. The key is 
restricting the syntax of labeled statements. If we find a way to do this, it 
won't extend to the object initialiser shorthand or variations like the one you 
propose. But it may be that we can't solve this riddle without GLR anyway, 
which could doom it.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to