Generator Arrow Functions

Brandon Benvie bbenvie at
Tue Nov 12 16:37:55 PST 2013

Currently, it's not allowed that arrow functions be generators. I did a 
bit of searching and couldn't find the original reasoning behind this. 
`*() => {}` doesn't seem to be a problematic grammar since `foo * () => 
{}` isn't valid. The problem I do see is the mismatch between the 
generator class hierarchy and the fact that arrow functions don't have 
prototypes. I think this could be worked around somehow though.

The use case I've started running into a lot is using Task.js with methods:

class Foo {
   foo() { //--> Promise
     return Task.spawn(*() => {
       const value = yield this.get(this.base + "/foo");
       if (yield {
         return true;

   bar(value) { //--> Promise

   get(url) { //--> Promise

Without generator arrows, I'm back to using `var self = this` or 

More information about the es-discuss mailing list