Jeremy Howard wrote:
> 
> The problem with making these builtins respect the number of return values
> context in want() is that, as Nate mentions, the expressions may have
> side-effects that are desired for the whole list.
> 
> An alternative approach is to make these builtins respect lazy(), as defined
> by RFC 123:

This is a worthwhile alternative, I like it. The only problem is that
this doesn't address problems like this:

   my($line) = <$FILE>;

Which will still gobble the whole handle unless you say "lazy()";

Since both lazy() and my proposal are going to talk about lazy behavior,
I would say perhaps the best approach is a merging of the two:

   1. Assume lazy() where it "can't hurt", as in the above
      example.

   2. Don't assume lazy() where it can (like in grep/map)

My proposal was going to say that lazy behavior was optional anyways, so
lazy() is really just a different optional way of going about it.

> That way the programmer could decide whether or not they want the Perl 5
> list-gobbling behaviour, or lazy behaviour, as they require.

I like this, but I also like the ability for the function to DWIM ala
split, without me having to explicitly tell it to. It could make scripts
faster without any extra coding.

Input?

-Nate

Reply via email to