New Proposal: Placeholder syntax

Waldemar Horwat waldemar at google.com
Fri Dec 7 22:51:05 UTC 2018


On 11/28/2018 10:17 AM, Andrew Kaiser wrote:
> Hi all,
> 
> I have created a short proposal to introduce syntactic sugar for anonymous functions in a 'scala-like' manner, linked here https://github.com/andykais/proposal-placeholder-syntax.
> 
> I am hoping to hear feedback on whether or not this is interesting to people, as well as feedback on the proposal itself (e.g. is there a better operator to use than ` * `)

This is error-prone:

   const sum = numbers.reduce(? + ?)
transforms into
   const sum = numbers.reduce((x, y) => x + y)

but then:

   const identity = numbers.reduce(?)
transforms into
   const identity = (x) => numbers.reduce(x)
instead of the analogous
   const identity = numbers.reduce((x) => x)

And what would
   const z = numbers.reduce(? + ? > 0)
or
   const z = numbers.reduce(2*(? + ?))
or
   const z = numbers.reduce(foo(? + ?))
transform into?

     Waldemar


More information about the es-discuss mailing list