Andrew Kaiser (2018-12-12T16:22:40.000Z)
thank you all for the feedback, I appreciate those who pointed out the
flaws in the logic. I can see that this is an ambiguous proposal. Though I
did not realize it at the time, this proposal is competing with
https://github.com/tc39/proposal-partial-application, as the two syntax's
cannot exist in the same language. I still find the scala-like pattern
useful, and not all hope is lost. There is a babel macro
https://www.npmjs.com/package/param.macro which was inspired by scala's `_`.

Side note, they solve the issue of `g(f(?))` creating either `x => g(f(x))`
or `g(x => f(x))` by splitting the logic into two different macros, `it`
and `_`.

```
import { _, it } from 'param.macro'

const arrayOfObj = [{ n: 1 }, { n: 2 }, { n: 3}]

arrayOfObj.map(it.n)
// yeilds
// arrayOfObj.map(x => x.n)

arrayOfObj.map(_.n)
// yeilds
// x => arrayOfObj.map(x.n)
```

If anyone is interested in keeping the proposal alive/modifying it, feel
free to put a pull request on my repo
https://github.com/andykais/proposal-placeholder-syntax. Otherwise, I don't
believe I see a lot of interest in it according to this discussion.


On Fri, Dec 7, 2018 at 5:51 PM Waldemar Horwat <waldemar at google.com> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20181212/ffcdc5b1/attachment.html>
kaisea.rpi at gmail.com (2018-12-12T16:39:29.122Z)
thank you all for the feedback, I appreciate those who pointed out the
flaws in the logic. I can see that this is an ambiguous proposal. Though I
did not realize it at the time, this proposal is competing with
https://github.com/tc39/proposal-partial-application, as the two syntax's
cannot exist in the same language. I still find the scala-like pattern
useful, and not all hope is lost. There is a babel macro
https://www.npmjs.com/package/param.macro which was inspired by scala's `_`.

Side note, they solve the issue of `g(f(?))` creating either `x => g(f(x))` or `g(x => f(x))` by splitting the logic into two different macros: `it` and `_`.

```javascript
import { _, it } from 'param.macro'

const arrayOfObj = [{ n: 1 }, { n: 2 }, { n: 3}]

arrayOfObj.map(it.n)
// yeilds
// arrayOfObj.map(x => x.n)

arrayOfObj.map(_.n)
// yeilds
// x => arrayOfObj.map(x.n)
```

If anyone is interested in keeping the proposal alive/modifying it, feel
free to put a pull request on my repo
https://github.com/andykais/proposal-placeholder-syntax. Otherwise, I don't
believe I see a lot of interest in it according to this discussion.
kaisea.rpi at gmail.com (2018-12-12T16:38:33.242Z)
thank you all for the feedback, I appreciate those who pointed out the
flaws in the logic. I can see that this is an ambiguous proposal. Though I
did not realize it at the time, this proposal is competing with
https://github.com/tc39/proposal-partial-application, as the two syntax's
cannot exist in the same language. I still find the scala-like pattern
useful, and not all hope is lost. There is a babel macro
https://www.npmjs.com/package/param.macro which was inspired by scala's `_`.

Side note, they solve the issue of `g(f(?))` creating either `x => g(f(x))` or `g(x => f(x))` by splitting the logic into two different macros: `it` and `_`.

```
import { _, it } from 'param.macro'

const arrayOfObj = [{ n: 1 }, { n: 2 }, { n: 3}]

arrayOfObj.map(it.n)
// yeilds
// arrayOfObj.map(x => x.n)

arrayOfObj.map(_.n)
// yeilds
// x => arrayOfObj.map(x.n)
```

If anyone is interested in keeping the proposal alive/modifying it, feel
free to put a pull request on my repo
https://github.com/andykais/proposal-placeholder-syntax. Otherwise, I don't
believe I see a lot of interest in it according to this discussion.