From: "Will Coleda" <[EMAIL PROTECTED]> Date: Fri, 08 Dec 2006 16:00:37 -0500
Given the current :method and .yield implementations . . . . . . Which is unsurprising given the current implementation. Is this desired behavior, though? This does not work right for nonmethods either. For normal subs, you have to find the sub and clone it, and then use that as the Coroutine. For methods, this would amount to creating a new method per instance, which is absurd. I can work around this by storing an attribute on the class which keeps my counter in the instance and then retrieving it with getattribute in the loop, insuring that the state is pulled from the object instead of the registers in the coroutine/method whenever the coroutine resumes. If you can do that, then you don't really need a Coroutine, do you? But if you really can't do that, you might consider Parrot::Coroutine. Or we could have yield somehow be instance specific. The real fix is to build Coroutine on Continuation instead of Sub. That would still require changing your method to create a Coroutine object and (I assume) store it in the instance. But that might be what you want in any case. Perhaps the right thing would be clearer if you posted a fuller example of what you are trying to do? -- Bob Rogers http://rgrjr.dyndns.org/