Juerd writes:
> Luke Palmer skribis 2005-05-01  1:17 (-0600):
> > Umm... maybe I'm totally misunderstanding you, but I think it doesn't,
> > since I'm implementing statement:<while>, not statement:<for>.
> 
> Sorry, I wasn't clear enough. How would the same "is lazy" thing be
> useful with "for", given this example?

Ahh.  It wouldn't.  Which is a pretty good example of why "is lazy" is
the wrong name.  

"is lazy" is used for the condition of "while", the right side of || and
&&, etc.  It is for when you pass a closure without putting braces
around it.

Well, almost like that.  We still have to handle:

    while my $line = =<> {...}
    # $line still in scope

Which is different from:

    &statement:<while>({ my $line = =<> }, {...});
    # $line not in scope

Anyway, "for" doesn't need "is lazy", because it simply evaluates the
list it is given and iterates over it.  The fact that evaluating the
list may be a no-op because of laziness is unrelated to "is lazy"
(another hint that it's the wrong name).

Luke

Reply via email to