On Fri, Jul 14, 2017 at 8:11 PM, Bob Myers <r...@gol.com> wrote:
> The proposal to write `arr.reduce((+))`, with `(+)` as an alternative to
> `(a, b) => a + b` is admirably concise, but syntactically challenging. I
> propose an alternative which is slightly less compact, but hopefully more
> implementable and general.
>
> The idea is a new form of function we'll call a "pound function", written as
> `#{ }`, Within the body, parameters are available as `#0`, `#1`, etc. Thus,
> the example about would be written as
>
> ```js
> arr.reduce(#{#0 + #1})
> ```

This is incredibly close to `arr.reduce((x,y)=>x+y)`.  They're even
both 10 characters (tho yours is 8 character if you remove the
whitespace around the `+`, like I did with the arrow function).

I don't think one can reasonably justify adding more syntax (and
eating another useful ASCII glyph) just to reduce some types of arrow
functions by a few more characters; arrow functions are already
incredibly compact.

~TJ
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to