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

Re: Multiple post(inc|dec)rement

Thread Previous | Thread Next
From:
Johan Vromans
Date:
January 16, 2001 13:10
Subject:
Re: Multiple post(inc|dec)rement
Message ID:
20010116210746.B17A657A80@phoenix.squirrel.nl
Stephen McCamant <smcc@CSUA.Berkeley.EDU> writes:

> JV> But I still think that
> JV> perl -e '@a = (++$i,++$i,++$i); print "@a\n"'
> JV> should print "1 2 3".
> 
> IMHO, pp_pre(inc|dec) were written the way they are now for a reason
> (namely efficiency), and it isn't worth slowing them down just to make 
> some pathological examples more intuitive. If you want "1 2 3", you
> can always write

Darn. I know a zillion ways to get "1 2 3" in an array :-).

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

-- Johan

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