Look, I know this is Much Ado About Nothing -- except it aint.
However, I do remember taking a Long Time to make the connection between
shift and @_,
And I'd never think of "shift @_", even today.
Rather, I'd just change the comment a bit. -- And suggest this kind
of wording is used more
extensively (but NOT universally) ... why not
# gets a reference to an array as a single parameter, out of @_
?
Nathan Torkington wrote:
>Charlie Stross writes:
>
>>getting heavily into sorting algorithms). I'd be a bit happier if it was
>>written as:
>>
>> sub fisher_yates_shuffle {
>> # Takes a single parameter, a reference to an array
>> my $array = shift @_;
>>
>
>I wouldn't :-) If someone wrote 'shift @_' in a program that I was
>reviewing, I'd strike out the @_. The style I advocate is either
>
> my $arg = shift;
>or
> my ($arg1, $arg2) = @_;
>
>Anyway, we're straying far from home. I'm working on a commit that
>adds a comment describing the argument, and a variable name change
>to $to_shuffle. That should solve the problem.
>
>Lessons learned:
> * comment subroutine arguments in code
> * meaningful variable names beat programmatically-descriptive ones
> hands-down
>
>Nat
>