some generator issues
nmix at pandora.com
Mon Apr 23 08:08:26 PDT 2007
>> The unwieldy part being that you're required to set
>> arguments.generator to a local var because otherwise the arguments
>> object gets masked. But this could be simplified a little if you
>> could obtain a send() delegate directly from the generator object:
> Wouldn't Function.prototype.bind
> (http://developer.mozilla.org/es4/proposals/static_generics.html) be
> sufficient for this?
Yes, although a bit wordy as you point out.
> It's definitely wordier, but the user could also easily implement your
> delegate() method above by adding it to Function.prototype.
I don't follow -- did you mean Generator.prototype?
> Alternatively, we could make gen.next() and gen.send() special in that
> they are already prebound to gen (e.g. gen.send.call(anotherGen) still
> results in gen.send()). Personally, I'd rather not do this - pretty
> all builtin classes have unbound prototype methods rather than bound
> instance methods.
More information about the Es4-discuss