On Mon, Sep 26, 2005 at 05:42:31PM +0200, Juerd wrote: : Piers Cawley skribis 2005-09-26 16:34 (+0100): : > And you've done it again. What you ask for is already there. See below. : > next if (($_ ne 'boo')..undef) : > if 0..MAX { push @buffer, $_; next } : : IIRC, flip flop will not return as the ".." operator.
That's correct, though we haven't decided what to call the flipflop operator. Wants to be relatively long, huffmanly speaking, so flipflop() could work. Could maybe be infix:<thru> or infix:<till> or some such. Could have ^ forms as well. I'm not sure about preserving the line number hack though. : Also, the global : state of syntactic flip flops makes me be afraid of using them in subs. When you say that sort of thing nowadays, think "state" variables. So if truify() till falsify() {...} macroizes to something like: if state $s ?? $s = falsify() !! $s = truify() {...} Actually, I think that's the old ... operator. You'd write it slightly differently to allow it to falsify immediately. if state $s ?? $s = falsify() !! $s = truify() && !falsify() {...} Or something like that... But yes, even with that desugaring, it does mean you're not writing "pure" code in the functional sense. Larry