3 ms·
What about the "shorter function syntax" (from strawman http://wiki.ecmascript.org/doku.php?id=strawman:shorter_function_syntax http://wiki.ecmascript.org/doku.
by mrspeaker 16y ago
What about the "shorter function syntax" (from strawman http://wiki.ecmascript.org/doku.php?id=strawman:shorter_function_syntax http://wiki.ecmascript.org/doku.php?id=strawman:shorter_func... )? I'm crossing my fingers and toes that this makes it in.
- munificent 16y agoTraceur 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).
- ericmoritz 16y agoWe definitely could use something like this.
- olavk 16y agoThis 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.
- grayrest 16y agoBrendan 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.