develooper Front page | perl.perl5.porters | Postings from August 2008

Re: unless(...) terser than if(!...)

Thread Previous | Thread Next
Yitzchak Scott-Thoennes
August 28, 2008 16:29
Re: unless(...) terser than if(!...)
Message ID:
On Thu, August 28, 2008 2:45 pm, Nicholas Clark wrote:
> If I write this:
> $ ./perl -Ilib -MO=Concise -e 'print if !$a'

> it uses one more op than the semantically equivalent:
> $ ./perl -Ilib -MO=Concise -e 'print unless $a'

> Couldn't we optimise the former to the latter fairly easily?

In void context, yes.  (I wouldn't worry about the ! vs. bool
overload difference.)

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