develooper Front page | perl.perl5.porters | Postings from July 2010

Re: [perl #76438] peephole optimiser could prune more dead code

Thread Previous | Thread Next
From:
Abigail
Date:
July 29, 2010 06:28
Subject:
Re: [perl #76438] peephole optimiser could prune more dead code
Message ID:
20100729133009.GH3850@almanda
On Tue, Jul 13, 2010 at 06:55:33PM +0100, Ben Morrow wrote:
> Quoth nick@ccl4.org (Nicholas Clark):
> > On Tue, Jul 13, 2010 at 01:11:11PM +0000, ?var Arnfj?r? Bjarmason wrote:
> > 
> > > Of course we can't liberally change things that are documented to be
> > > undefined as liberally as a C compiler would, becuase there's only one
> > > perl(1) but multiple cc(1)'s.
> > 
> > But whatever we call it, that's the key problem. There is only one
> > implementation, and as that implementation strives hard to internally avoid
> > C undefined behaviour, its output will be deterministic, in some fashion.
> > Hence people come to rely on the current behaviour of the implementation,
> > documented or not.
> 
> Quite. And 
> 
>     print $i++, $i++;
> 
> has DWIM forever (probably since perl 1). I'm not saying we *cannot*
> change it, just that any change needs to be either only within the scope
> of a lexical pragma or to go through a full deprecation cycle with
> mandatory warnings before it changes.



Actually, I added the explicite statement about undefinedness in the
documentation, because not all expressions containing multiple $i ++
did DWIM for everyone, leading to lots of (pointless) discussions on
what the 'right' value of complicated statements where supposed to be.


  $i = $j = 1;
  print $i ++, $i ++;   # Prints 12.
  print ++ $j, ++ $j;   # Prints 33.  Both are really DWIM?


Abigail

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