On Tue, 2006-07-11 at 10:06 -0400, Aaron Sherman wrote:
> For example:
>  our List multi Container::each(Container [EMAIL PROTECTED])

In thinking about each, I've come across an interesting need. I wrote
this example:

 for each(=<>; 1..*) -> ($line, $lineno) {
   say "$lineno: $line";

Which is obviously an infinite loop. You could re-write that:

 for each(=<>; 1..*) -> ($line, $lineno) {
   $line err last;
   say "$lineno: $line";

But would it be reasonable to also provide a named-only parameter to
each for that purpose?

 our List multi Container::each(Bool :$stop, Container [EMAIL PROTECTED])

So that:

 for each(:stop, =<>; 1..*) -> ($line, $lineno) {
   say "$lineno: $line";

would only iterate until one of the containers was exhausted (in this
case, the filehandle).

Should this be added? Should zip have the same modifier?

Aaron Sherman <[EMAIL PROTECTED]>
Do you find yourself thinking Unicode has too many crosses? ✙✚✛✜✝✞✟✠☦☨☩†

Reply via email to