Proposal: Concise instance initialisation
Sean Eagan
seaneagan1 at gmail.com
Tue May 24 07:37:19 PDT 2011
On Tue, May 24, 2011 at 9:10 AM, Brendan Eich <brendan at mozilla.com> wrote:
> On May 24, 2011, at 7:02 AM, Sean Eagan wrote:
>
>>> This conflicts with the existing:
>>> var foo = "bar";
>>> {foo} // "bar"
>>> {!foo} // false
>>>
>>
>> No, just because |{!b}| is current syntax, doesn't mean that |var a = {!b}| is.
>
> I've been working on syntax lately, and based on that work, I think this goes too far. It requires splitting the grammar in a way that needs greater parsing power than LR(1), e.g. GLR. Unlikely to get by TC39 and implementors.
>
> It would be better to preclude the ! and ~ prefixes from being used with the {b} shorthand.
>
> /be
>
>
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.
Thanks,
Sean Eagan
More information about the es-discuss
mailing list