On Sat, Jul 20, 2013 at 4:37 PM, Rick Waldron <[email protected]> wrote:
>
>
>
> On Sat, Jul 20, 2013 at 4:05 PM, Andrew Fedoniouk
> <[email protected]> wrote:
>>
...
>>
>> Or even this: (one token lookahead required)
>
>
> More then that, a whole new language that doesn't yet have existing grammar
> rules...

It is far less complex than that "fat arrow" syntax.

>
>>
>>
>> el.on : "click", function() {....};
>> el.myplugin : {....};
>
>
> If the function at the call site isn't the method of an object, both
> examples above turn into code that is already completely valid JavaScript in
> the existing grammar
>
> Given:
>
>   function foo(o) { return o; }
>
> The first turns into a labelled statement, followed by a comma operator
> expression:
>
>   foo: "click", function() {}; // function() {}
>
> The second turns into a label statement, followed by an empty block body:
>
>   foo: {}; // undefined
>

As I said that requires one token lookahead:

name ':' while|for|do -> labeled statement, else
name ':' ArgumentList -> function call

The main problem may arise with '?' operator though.

var r = cond ? name1 : name2;

Such function call has to have less precedence than the '?' to keep
existing code correct.


--
Andrew Fedoniouk.

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

Reply via email to