[Posted and mailed]

In article <238620000.1037824657@[192.168.200.4]>,
 [EMAIL PROTECTED] (Steven Lembark) writes:
>
>
>-- Peter Scott <[EMAIL PROTECTED]>
>
>> In article <[EMAIL PROTECTED]>,
>>  [EMAIL PROTECTED] (Abigail) writes:
>>> On Wed, Nov 20, 2002 at 11:42:43AM +0100, Bart Lateur wrote:
>>>> 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?
>>>
>>> Why is that bad style? Many times when people say it's bad style,
>>> it's just a case of "beauty is in the eye of the beholder".
>>
>> It forces the reader to think about associativity and order of evaluation.
>> If you've been bitten by unexpected outcomes before you might have to
>> try it to make sure it does what you think.
>>
>> I've used shift, shift before, so I already know.  But it would be unfair
>> to foist on a junior maintenance programmer, IMHO.
>
>Associativity? 

Of the commas.  A suitably paranoid programmer is going to wonder whether
the results will occur in the expected order if they've not tried before.
It won't occur to a novice.  And an expert will already know.  But someone
in between may wonder.

>This just takes the first three items
>off the arguments (leaving the rest of it on @_),
>puts them on a list, and assigns it. I've had more
>problems with junior programmers botching the order
>of separate assignments (or more often deleting one
>out of the middle) than mis-understanding how shift
>works. Even fewer of the people walking around
>understand splice (which is where I came up with the
>list-of-shifts).

I don't think splice is that bad; it's a straightforward function.
You have to make sure the count matches the number of elements on the
left, just as you have to match the number of `shift's.

An argument this subjective is unlikely to reach a definitive resolution.

-- 
Peter Scott

Reply via email to