On 8/17/06, Jonathan Scott Duff <[EMAIL PROTECTED]> wrote:
Depends on when it fires I guess. Your example might be equivalent to
this perl5ish:

    while (1) {
        $num = rand;
        print $num;
        last if $num < 0.9;
        print ",";              # NEXT
    }
    print "\n";                 # LAST

Which, incidentally, relates back to the discussion at hand.  If this
were the case, though, the state of the variables (in three-arg for
loops and side-effecty while loops) would seem to reflect the state of
the next iteration from the rest of the code.  It would also
(obviously) fire after user input for eg. a for =<> loop.

So, unless the next paragraph is feasible, I think NEXT ought to be
equivalent to LEAVE, perhaps with the exception of exceptional
circumstances.

But I was talking about hypotheticalization.  That is, unless I am
mistaken we have temp {} and let {} using UNDO blocks (which are given
default definitions where possible).  So perhaps we could use that
feature to provide a NEXT trait which actually executes only if there
is a next iteration, while giving the block the impression that it is
executing in the previous iteration.  This, of course, would not work
for loops whose conditions have irreversible side-effects.

Overall, it might be feasible in some circumstances, but it may not be
worth it.  Its implementation (and usage caveats) are quite complex
for a relatively minor convenience feature.  For a user to implement
its effect by himself, using the extended knowledge he has of the loop
semantics, would probably not take more than four extra lines in the
worst case.

Luke

Reply via email to