Rod Adams writes:
> Better documentation on gather/take is merited.

Without a doubt.

> I would question the need for C<gather>, however. Could not a lone 
> C<take>/C<emit> force the return value of the enclosing routine/closure 
> to be a lazy list, and here's a few values to get things started?

C<gather> is necessary.  Coroutines are most useful in recursion, so you
need to know to which gather the emit is going.  "From the current
function" isn't good enough, because of this case.

Luke

> >2. Should a subsequent implicit return behave differently than usual 
> >if some values have already been emitted?
> 
> This is a bit harder, but I would think it should emit it's parameters, 
> then exit the routine.
> The downside would be it forces list context where it might not have 
> existed before, but it's the most consistent thought I have.

Also gather/take addresses this problem, as there's an explicit return:
the result of the gather.  You can also return something else if you see
fit.

I just think it's a much more versatile and controlled construct than
the more implicit "emit".  I like to have control over my programs.

Luke

Reply via email to