Andrew Fedoniouk (2013-07-11T04:39:26.000Z)
I see [1] that arrow function syntax got specification state.

The problem with this construction: it's the only feature in ES syntax
so far that
requires compiler to use full AST implementation at compilation phase.

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?

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?

[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
domenic at domenicdenicola.com (2013-07-12T04:08:33.003Z)
I see [1] that arrow function syntax got specification state.

The problem with this construction: it's the only feature in ES syntax so far that requires compiler to use full AST implementation at compilation phase.

Consider this:

```js
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?

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?

[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