On Jul 10, 2013, at 9:39 PM, Andrew Fedoniouk wrote: > I see [1] that arrow function syntax got specification state.
so, you should probably look at the relevant parts of the draft specification http://people.mozilla.org/~jorendorff/es6-draft.html#sec-5.1.4 http://people.mozilla.org/~jorendorff/es6-draft.html#sec-11.1 http://people.mozilla.org/~jorendorff/es6-draft.html#sec-13.2 > > The problem with this construction: it's the only feature in ES syntax > so far that no, it also occurs between object literals and destructuring assignment object patterns. > requires compiler to use full AST implementation at compilation phase. you don't necessarily have to built a full AST. In some cases you will need to at least do multiple parses of the same text. > > Consider this: > > var val1 = 1; > var val2 = 2; > var sum1 = (val1, val2) + 1; // integer > var sum2 = (val1, val2) => val1 + val2 ; // function > var sum3 = (val1, true) ; // true > > As comma is a valid operator in ES than to generate code for the expression > (val1, val2) is only possible when next token past ')' is seen. That requires > as I said full blown AST analysis - list in '(' ')' parenthesis shall > be parsed and > stored. Only next token triggers how that list will be interpreted. > > So far almost all other syntax features in ES can be parsed with > single token look ahead. > That makes possible quite fast source-> bytecode translation schema that makes > great sense for the embeddable languages like ES. > > Is that arrow syntax still debatable? No really. This was known when the arrow syntax was choses. > > Asking because Ruby-ish syntax [2] is significantly better in this respect. > > And in TIScript [3] I am using similar approach but with ':' symbol: > > ':' <param-list> ':' <expresion> > ':' <param-list> '{' <statement-list> '}' > > Example, descending sorting: > > arr.sort( :a,b: a - b ); > > Too late? Yes, but primarily in the sense that such issues were already considered. Allen > > [1] http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax > [2] http://wiki.ecmascript.org/doku.php?id=strawman:block_lambda_revival > [3] > http://www.codeproject.com/Articles/33662/TIScript-language-a-gentle-extension-of-JavaScript > > > -- > Andrew Fedoniouk. > > http://terrainformatica.com > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

