I think JavaScript has reached "peak token"... I also wanted to use the # for generic map/list literal syntax: https://esdiscuss.org/topic/map-literal
On 15 July 2017 at 04:24, Isiah Meadows <isiahmead...@gmail.com> wrote: > Few nits inline: > > ----- > > Isiah Meadows > m...@isiahmeadows.com > > Looking for web consulting? Or a new website? > Send me an email and we can get started. > www.isiahmeadows.com > > > On Fri, Jul 14, 2017 at 11: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. > > Actually, it's not as *syntactically* challenging as you might think; > it can be discerned just by recognizing the token sequence `(` @ `)`, > where @ is the operator's token in question. > > > > > 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. > > Potential complication: the parameter names visually conflict with the > private member proposal. > > https://github.com/tc39/proposal-class-fields > > > > > ```js > > arr.reduce(#{# + #}) > > arr.sort(#{#.order - #.order}) > > ``` > > This quite honestly looks like line noise. Also, it doesn't look clear > at a glance whether it should be equivalent to `(a, b) => a + b` or `a > => a + a` (using the first example). > > > > > If need be, we can define `...##` inside pound functions as referring to > the > > argument list, so > > > > ```js > > const sumParams = #{##.reduce(#{# + #})}; > > ``` > > That does not look very elegant nor readable. > > > > > Ugh. Anyway, I will leave it others to opine on whether this cryptic > syntax > > is worth the trouble, issues related to nested pound functions, etc. etc. > > > > You might want to investigate Clojure's [1] and Swift's [2] similar > existing syntaxes for this. > > [1]: https://coderwall.com/p/panlza/function-syntax-in-clojure > [2]: https://developer.apple.com/library/content/documentation/ > Swift/Conceptual/Swift_Programming_Language/Functions.html > > > > > Bob > > > > > > > > _______________________________________________ > > es-discuss mailing list > > es-discuss@mozilla.org > > https://mail.mozilla.org/listinfo/es-discuss > > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss