develooper Front page | perl.perl5.porters | Postings from January 2001

Re: Multiple post(inc|dec)rement

Thread Previous | Thread Next
Stephen McCamant
January 16, 2001 16:39
Re: Multiple post(inc|dec)rement
Message ID:
>>>>> "GNat" == Nathan Torkington <> writes:

GNat> Johan Vromans writes:

JV> My point is that unlogical exceptions like @a = (++$i,++$i,++$i)
JV> are hard to explain, and make people turn away from Perl.

GNat> Could the optimizer spot multiple side-effects in an expression
GNat> and pessimize it accordingly?

If you mean a syntactic expression, then yes, I think that would be
possible. In general, though, side effects might be hidden in
subroutines, AUTOLOADed subroutines, evals, etc:

perl -e 'sub f {++$i}; print ++$i, f(), "\n"'

It doesn't seem obvious to me that there's an easy or foolproof way to 
do this, though, and a half-right solution would probably be worse
that a the current situation, at least as far as being predictable and 

 -- Stephen McC

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