Pense, Joachim said:
> Bart Lateur [mailto:[EMAIL PROTECTED]] wrote:
> (Mittwoch, 20. November 2002 11:43)
>
>>On Wed, 20 Nov 2002 04:10:02 -0600, Steven Lembark wrote:
>>
>>>sub commify
>>>{
>>>     my ( $max, $sep, $end ) = ( shift, shift, shift );
>>      ...
>>>}
>>
>>Wow! Hold it! Am I the only one who finds this absurd? More than one
>> shift on the same array in one single expressing, sounds like bad style
>> to me. Comments?
>
> In one of my programs, this would be
>
> sub commify {
>     my $max = shift;
>     my $sep = shift;
>     my $end = shift;
>
>     ...
> }
>
> better or even worse in your view?

Better.  As far as I am aware, Perl doesn't provide any guarantees on the
order of evaluation of expressions between what C calls sequence points.

Of course, Perl doesn't have sequence points, and has only one interpreter
which generally works from left to right, but it's probably not good to
rely on that.  If nothing else it will screw you up when you write XS.  Or
maybe Perl 6 ;-)

What does this print?

  perl -le 'print $i += $i++ + ++$i'

Might is reasonably print something else?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Reply via email to