develooper Front page | perl.perl5.porters | Postings from September 2013

Re: [perl #116020] toggle operator missing reset: proposal

Thread Previous | Thread Next
Eric Brine
September 6, 2013 15:50
Re: [perl #116020] toggle operator missing reset: proposal
Message ID:
On Wed, Aug 28, 2013 at 4:19 PM, Zefram <> wrote:

> via RT wrote:
> >My proposal:
> >  Since we can label any statement (now), why not have the reset operator
> take a label argument?
> I think the toggle operator is a wart that we should lean towards
> removing, not something to encourage wider use of.

Use of global vars/states keeps getting us into trouble.

This would be easy to implement using Devel::CallParser:

my $toggle;
while (...) {
   if (flipflop($toggle, EXPR1, EXPR2)) {

It's not much more complicated than the existing syntax, and it could allow
C<next> and such to work (unlike a sub(&) approach).

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About