On Sat, Jul 20, 2013 at 7:53 PM, Andrew Fedoniouk <[email protected] > wrote:
> 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. > Fat arrow isn't ambiguous with existing grammar, which implies that it is indeed less complex. > > > > >> > >> > >> 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 > This is incomplete. The following is a syntactically valid ES program, that never mentions "while|for|do" label: "click", function() {}; label: "click", function() {}; function label(o) { return o; } label: {}; label: {}; label: var a = "hi!"; label: var a = "hi!"; label: function foo() {} label: function foo() {} label: (a = 1); label: (a = 1); label: [1, 2, 3, 4]; label: [1, 2, 3, 4]; label:; > name ':' ArgumentList -> function call > See above. > > 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. > Sure, this can be the "main" problem if you want. Rick
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

