On Mar 29, 2005, at 8:38 AM, Luke Palmer wrote:
Hmm... I believe that the behavior in this case is undefined.  It sure
would be nice if it worked, but you see:

    for =$fh -> $line { ... }

Evaluates `=$fh` in list context.  In an eager world, this eats up the
whole file in one go.  In the ideal lazy world, it reads one line at a
time (which would allow this example to work... I think).  And perhaps
that's how we need to define it.

Personally I like the idea of this being lazy, as I like 'for' better than 'while' as a construct. But that is just opinion.


Even is list context I see a (lazy) readline as being much like:

        for (0 .. Inf) -> $num {}

or:

        for (0 ...) -> $num {}

which (to the best of my understanding) creates a lazy list of 0 to infinity.

Either way I agree, it should be specified (my vote is for lazy).

- Steve



Reply via email to