My apologies if this has already been covered, but can anyone point to the rationale for arrow functions (primarily) targeting mappings?
I think it's fairly self-evident that they are a natural fit for such use cases, but I find it less self-evident that they are inherently not useful for others (e.g., generators). I feel like I keep seeing the following (implied) argument: 1) Arrow functions are good for mappings 2) Generators aren't mappings 3) Arrow functions aren't good for generators. Grammar problems aside, I guess I don't follow the reasoning to #3. Conversely, I think that a case could be made that minimizing the differences between "normal" functions and arrow functions is desirable in its own right. On Thu, Dec 12, 2013 at 1:37 PM, Kevin Smith <[email protected]> wrote: > >> =>, *=>, !=> >> =>, =*>, =!> >> =>, *>, !> >> >> Which do you hate least? >> > > Hate is such a strong world... : ) > > My aesthetic judgement is that "!" is not a good choice because grawl is > bad for beginners. And async functions will touch beginners quite heavily > (I predict). > > >> >> Btw, Kevin, I have read and do not understand your argument about why we >> would not want generator arrow functions but would want async arrow >> functions. If we could agree on syntax, I still want both. >> >> > Let me restate first. > > At a conceptual level, arrows are mappings. "x goes to whatever". That > is the niche they fill. That's why they are so beautifully suited to, for > example, array iteration functions, promise callbacks, and even event > listeners (which can be considered mappings to void). > > Async arrows fit right into that niche, except asynchronously. "x goes to > Promise<whatever>". They will be well-suited to event listeners, in > particular. (See my OP for an example.) > > Generators, on the other hand, are a way of implementing a sequence. As > such, they don't fit into that "arrow" niche. > > But aren't async functions going to be implemented with generators, > basically? Well, yes, but that's just an implementation detail. > Generators will probably be used to implement async functions, but they > are completely different at a conceptual level. > > I believe that once we have async functions (and async arrows), the need > for a lightweight generator syntax will largely evaporate. > > Or to put the question on more utilitarian ground: given async functions > and async arrows, what use cases are left for generator arrows? > > > > > > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > > -- Jeremy Martin 661.312.3853 http://devsmash.com @jmar777
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

