Generator Arrow Functions

Rick Waldron waldron.rick at gmail.com
Fri Nov 15 08:59:44 PST 2013


On Fri, Nov 15, 2013 at 11:34 AM, Axel Rauschmayer <axel at rauschma.de> wrote:

> It would be great to have await, but in the meantime having generator
> functions would help male async methods tolerable. Await is ES7 at the
> earliest, generator arrow functions could be in ES6.
>
>
> Couldn’t arrow generator functions replace generator function
> declarations? In other words: is the dynamic `this` in generator function
> declarations ever useful?
>

As useful as it is in non-generator function declarations and expressions.
I agree that a generator arrow function adds balance, but replacement of
generator function declarations contradicts a balance.


> Then we’d have a nice symmetry in ES6:
>
> – non-method function = const + arrow function.
> – method = concise method definition
>
> – non-method generator function = const + arrow generator function.
> – generator method = concise generator method definition
>

Let me counter with:

function declaration, generator function declaration
function expression, generator function expression
concise method, concise generator method
arrow function (, generator arrow function)




>
> That would make the async programming code more compact, too (I’m assuming
> a nullary paren-free arrow variant and I prefer the asterisk after the
> arrow):
>

To be clear, this preference is inconsistent with all other generator forms
where the asterisk is before the params, per Brandon's original examples.

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131115/52d5c858/attachment.html>


More information about the es-discuss mailing list