in reply to Re: Perl 6 coroutines (RFC 31)
in thread Perl 6 coroutines (RFC 31)
Specifically, the first yeild returns a continuation object. Use that object to "resume", and it knows exactly which instance you mean. The resume should pass parameters, too. It would re-bind @_ in the function, so the line after yeild could look at that (again) if desired.
The resumer thing could be an object with various members, including call and reset and who knows what else. Or, it could return a function reference and just calling that will resume.
Details: the iterate() function would do set-up and yeild with a token, using another built-in function to generate it. Or it could be a separate statement that creates it and yeilds at once. Then it goes into the traversal loop.my $next= $container->iterate ('inorder'); while (my $node= $next->()) { ... }
What do you think? —John
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Perl 6 coroutines (RFC 31)
by MeowChow (Vicar) on Jul 14, 2001 at 08:16 UTC | |
by John M. Dlugosz (Monsignor) on Jul 14, 2001 at 22:59 UTC | |
by MeowChow (Vicar) on Jul 15, 2001 at 13:34 UTC | |
by John M. Dlugosz (Monsignor) on Jul 15, 2001 at 23:04 UTC | |
by MeowChow (Vicar) on Jul 15, 2001 at 23:13 UTC |