some generator issues

Brendan Eich brendan at mozilla.org
Mon Apr 23 11:18:46 PDT 2007


On Apr 23, 2007, at 10:55 AM, Neil Mix wrote:

> So if new keywords are verboten, and arguments.generator is verboten
> (which would be better than nothing, I say), then what's left?  Is a
> static method on the Generator class a reasonable option?

I wouldn't say that arguments.generator is verboten -- I was just  
arguing that arguments might not be the best place to stash this  
generator property. Your point about having to capture it also  
motivates the search for another way.

A static method would avoid the shadowing problem you raised. It  
would reflect on the current call stack, presumably finding the top- 
most generator activation, and extracting the generator-iterator  
reference (which generally must be kept somewhere reachable from that  
activation, to keep the generator-iterator alive). It seems slightly  
more winning to me, but still leaves an odd taste. Thoughts?

/be



More information about the Es4-discuss mailing list