On Mon, Oct 08, 2001 at 03:48:48PM -0700, ___cliff rayman___ wrote:
>
> Charlie Stross wrote:
>
> > ---snip---
> >
> > sub fisher_yates_shuffle {
> > # Takes a single parameter, a reference to an array
> > my $array = shift @_;
>
> you would not program it this way -
On the contrary: I _would_ program it that way. (At least, if I was
coding for an employer rather than for my own use with no intention of
ever releasing the code to anyone else.)
When writing code, it is a Bad Idea to assume that you're going to be
the person who maintains it. It is a Good Idea to work on the assumption
that the person who gets the maintenance job has got MOM and POP tatooed
on their hands so the police know who to take them home to when they
get lost; at least that way you won't have your old code come back to
haunt you. And the first step in writing maintainable code is to make
everything as explicit as possible.
This isn't how you'd do it in a JAPH or an obfuscated Perl contest. But
real life isn't a game, and assuming your co-workers will know what the
default behaviour of a function is when it's called without arguments is,
well, a frequently groundless assumption.
(Feel free to call me paranoid, but I've seen too many fuck-ups caused
by programmers who assume a high level of competence on the part of their
co-workers to feel comfortable about ignoring Murphy's Law.)
-- Charlie