GeneratorFunctionPrototype should probably be a function

André Bargull andre.bargull at
Tue Aug 13 09:41:09 PDT 2013

> Hi,
> Section of the July 15 draft says:
>      Properties of the GeneratorFunction Prototype Object
>      The GeneratorFunction prototype object is an ordinary object. It is
>      not a function object and does not have a [[Code]] internal data
>      property or any other of the internal data properties listed in
>      Table 13. In addition to being the value of the prototype property
>      of the %GeneratorFunction% intrinsic and is itself the %Generator%
>      instrinsic.
> See  <>  for
> the gnarlies.  To be explicit, we are talking about this object:
>    var GeneratorFunctionPrototype = function*(){}.__proto__;
> I think this object should be a function and not a normal object.
>    1. The spec doesn't specify any other objects for which "x instanceof
>       Function" that aren't functions.

Isn't that just because no other object inherits from the Function 
object in the specification? For example on the user level you can write 
`class MyFunction extends Function {}`, where `MyFunction.prototype 
instanceof Function` yields true, but `typeof MyFunction.prototype` is 
still "object". IIRC Allen even spec'ed GeneratorFunction similar to if 
it was written in the class syntax.

>    2. Function.prototype.toString is the binding for ".toString()" on
>       this object, but it is only applicable to function receivers.

The same restriction also applies to Number, String, Boolean, RegExp and 
Date (or rather to the corresponding prototype objects). So this is not 
a unique behaviour w.r.t. the GeneratorFunction prototype object.

> Sending here as I seem to have forgotten my bugzilla password, and the
> mail is taking too long to get here.  Sorry 'bout that.
> Regards,
> Andy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list