On Mon, Mar 14, 2005 at 05:28:29PM +0100, Miroslav Silovic wrote: > But it gets worse. > > my $lines = [ =$fh ]; > seek($fh, 0); > my $lines2 = [ =$fh ]; > close $fh; > > $lines2 must somehow remember that seek has happened.
That is fine because the three thunks are registered to the fh in evaluation order. What will be more fun is if they are all part of some other lazy lists, which may be accessed in some unpredictable order. That is why lazy languages typically use some sort of typechecking to avoid mixing computations with actions... :) Thanks, /Autrijus/
pgp0PQK7x77aI.pgp
Description: PGP signature