On Wed, May 04, 2005 at 02:22:43PM -0400, John Macdonald wrote:
> On Wed, May 04, 2005 at 10:43:22AM -0400, Aaron Sherman wrote:
> > On Wed, 2005-05-04 at 10:07, Aaron Sherman wrote:
> > > A coroutine is just a functional unit that can be re-started after a
> > > previous return, so I would expect that in Perl, a coroutine would be
> > > defined by the use of a variant of return
> A co(operating) routine is similar to a sub(ordinate) routine.
> They are both a contained unit of code that can be invoked.
> A subroutine carries out its entire functionality completely
> and then terminates before returning control back to the caller.
> This can be used for a large variety of functions.
> The most common (and what people sometimes believe the
> *only* usage) is as a generator - a coroutime which creates a
> sequence of values as its "chunk" and always returns control
> to its caller. ...
Notably, the grammar engine for Perl 6 rules is taking full
advantage of Parrot coroutines. Invoking a rule (coroutine)
causes the rule to continue until it completes a match, at which
point it returns the results of the match to the caller. But
the caller can later return control back to the rule/match so
that the matching (and backtracking) continues from where it