Syntax Proposal: Anonymous Arguments

Kenneth Powers ken at
Fri Sep 23 17:38:30 UTC 2016

I have a proposal for new syntax in ES inspired by the placeholder syntax
in Scala Functions

Essentially, the idea would be to allow anonymous arguments. The most
simple example would be a function which takes one argument (as far as the
programmer is concerned):

    [1, 2, 3].map(@ + 1)

This would be the same thing as:

    [1, 2, 3].map(n => n + 1)

Just like in Scala, an anonymous function is created. This concept can be
further extended in ES:

    [1, 2, 3].reduce(@0 + @1, 0)

Which would be the same thing as:

   [1, 2, 3].reduce((sum, n) => sum + n, 0)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list