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

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

Thread Previous | Thread Next
From:
Eric Brine
Date:
September 6, 2013 15:50
Subject:
Re: [perl #116020] toggle operator missing reset: proposal
Message ID:
CALJW-qHEW+TkzFgVAE7gQR_aJh2=2vTEf4mPG-E5uBY9pWoDDQ@mail.gmail.com
On Wed, Aug 28, 2013 at 4:19 PM, Zefram <zefram@fysh.org> 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About