Hi,
according to the new S03, till is the new name for the flipflop
operator.
Do the flipflop operators of subroutines maintain own
per-invocation-of-the-sub states? I.e.:
sub foo (&x) { x() till 0 }
foo { 0 }; # evaluates to a false value, of course
foo { 1 }; # evaluates to a true value, of course
foo { 0 };
# still true?
# (Argumentation: The flipflop is in the "true" state,
# so the LHS is not evaluated.)
# Or is it false?
# (Argumentation: The flipflop operator of the previous
# invocation is not the flipflop operator of the current
# invocation, so the return value is false.)
Also, all operators can be called using the subroutine form (which is a
very good thing), e.g.:
say infix:<->(42, 19); # 23
Is this true for till as well?
say infix:<till>(LHS, RHS);
But how would &infix:<till> maintain the state then, as no explicit ID
is passed to it? Does &infix:<till> access an internal %states hash,
using $CALLER::POSITION as keys?
Perl 5's flipflop operator appends "E0" to the final sequence number in
a range, allowing searches for /E/. My guess is that this is superseded
by "$sequence_number but this_is_the_endpoint_of_the_range" (you get
the idea). Correct?
--Ingo