In the case of sorting, are arrow functions not good enough? Or are we really asking for full continuation support
> On Oct 11, 2015, at 5:51 PM, Alexander Jones <[email protected]> wrote: > > IMO this is a good idea. When it's abundantly clear from context, I've > already been naming my arrow function params _ if singular, and _1, _2 etc if > several. As always, picking some punctuation straight from the scarce and > sacred set of remaining ASCII symbols is going to be tricky. (If only we > could just go APL on this!) > >> On 11 October 2015 at 16:45, Mohsen Azimi <[email protected]> wrote: >> Is it possible to extend JavaScript syntax to support Swift style block >> syntax[1]? >> >> In Swift it's possible to omit return keyword >> ``` >> reversed = names.sort( { s1, s2 in s1 > s2 } ) >> ``` >> >> or omit argument declaration like this: >> >> ``` >> reversed = names.sort( { $0 > $1 } ) >> ``` >> >> or apply an operator to arguments of a function >> >> ``` >> reversed = names.sort(>) >> ``` >> We have the first feature in ES2015 already: >> >> ``` >> let sorted = names.sort((a, b)=> a > b); >> ``` >> >> But for omitting argument declaration we need to find an alternative to $0, >> $1... since those are valid variable names in JS. Maybe we can use #0, #1... >> instead. >> >> This is very useful for functional programming aspect of JS. For example in >> a filter function: >> >> ``` >> let passed = objs.filter(#0.passed) >> ``` >> >> >> >> >> [1][https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html] >> >> _______________________________________________ >> 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
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

