Swift style syntax

Claude Pache claude.pache at gmail.com
Mon Oct 12 01:56:15 UTC 2015


> Le 11 oct. 2015 à 17:45, Mohsen Azimi <me at azimi.me> a écrit :
> 
> 
> 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)
> ```

Your syntax is ambiguous: Should your code be interpreted as:

    let passed = objs.filter($0 => $0.passed)

or:

    let passed = $0 => objs.filter($0.passed)

You need some syntax in order to delimitate the function.

—Claude


More information about the es-discuss mailing list