On Jul 10, 2011, at 6:58 PM, Brendan Eich wrote:

> On Jul 10, 2011, at 10:54 AM, Allen Wirfs-Brock wrote:
> 
>>>> 
>> 
>> Why not a non-writable,non-enumerable non-configurable data property on 
>> Function.prototype.
> 
> We're talking about isGenerator, right? There is no Generator constructor, no 
> shadowing opportunity. Function can create a generator if yield occurs in the 
> body string.

Oops, forgot we were talking about isGenerator.  So why not internally defined

const  __generatorProto__ = Object.create(Function.prototype, {isGenerator: 
{value: true}});

and specify that function containing yield are created as if by:
     __generatorProto__ <| function (...) {...yield...}

 In other words, generator functions have a different [[Prototype]] than 
regulator functions.

Alternatively, isGenerator could be a method, but that's the the point here.

Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to