Re:Google Releases JavaScript.next to JavaScript Compiler Tr...
by mrspeaker on Wednesday May 04, 2011 @04:09AM
(#2513131)
What about the "shorter function syntax" (from strawman http://wiki.ecmascript.org/doku.php?id=strawman:shorter_func... )? I'm crossing my fingers and toes that this makes it in.
[ Parent
| on HN ]
Re:Google Releases JavaScript.next to JavaScript Compiler Tr...
by olavk on Wednesday May 04, 2011 @11:00AM
(#2514025)
This seem to be a "bike shed" issue where everyone have their favorite syntax. Mascara supports function(a,b)a+b. "function" is still long though, so other suggestions is "#", "^", "fn", the florin-sign, "lambda" and others.
I think #(a,b)a+b is somewhat ugly, but it might win because it is unambiguous and doesn't collide with existing identifier.
My favorite lambda syntax is C#'s (a,b)=>a+b, but this may be rejected because it requires lookahead to parse.
Re:Google Releases JavaScript.next to JavaScript Compiler Tr...
by grayrest on Wednesday May 04, 2011 @01:37PM
(#2514588)
Brendan mentioned that he was wanting to keep # for something else and just adopt the coffeescript -> as the short form.
(x) -> x
(x) -> (x * x)
(x) -> {
for(let i = 0; i < x; i++){
console.log(i);
}
}
Was the set of syntax examples given.
Re:Google Releases JavaScript.next to JavaScript Compiler Tr...
by munificent on Wednesday May 04, 2011 @01:00PM
(#2514440)
Traceur dev here. It's on the to-do list. We've been mostly focused on stuff that's either approved for Harmony (modules, spread, etc.) or that we think will need a lot of iteration (classes, traits). I'm personally really keen on a better function syntax (especially a single-expression-body one).
Re:Google Releases JavaScript.next to JavaScript Compiler Tr...
by ericmoritz on Wednesday May 04, 2011 @09:02AM
(#2513650)
We definitely could use something like this.