On Mon, Jul 09, 2001 at 01:59:28PM +0200, Aaron Craig wrote:
> You are correct -- I should have read the documention :) However, in every
> day programming-speak, list and array get tossed about in such a way that
> they become synonymous.
They shouldn't be. The distinction can be important (see further down).
Part of being a programmer is being very exact in what terms one uses. This
stems from the fact that computers require exact input.
> A list and an array seem to be effectively the same thing -- except that a
> list is constant and an array is not. You might even say that a list is
> an array that you can't mess with.
Yes, you might say that, which makes them different. :)
> Which brings up a question on my part. Are there any examples of the use
> of an array and the use of a list where labelling them differently make
> something different happen? IE
There are many examples, but most of the ones I can think of boil down to
evaluating a list or array in scalar context.
> foreach (0..9); # list, correct?
> foreach (@array); # array
>
> to the average programmer, how does calling 0..9 an array screw them up?
It depends, how well do you know this "average programmer"? Perhaps they
have a keen grasp on which is which, and if you start misdescribing them
(say, in comments next to the code) you're going to start screwing them up.
The point is, over-generalizing doesn't help the person having to look at
your code. I can never remember the exact wording, but there's a saying
I've heard from various people: be liberal in what you accept, and strict in
what you say.
Even if the distinction isn't important except in academic circles (and
that's a big if), we are effectively -in- an academic circle; we're teaching
people how to use Perl, so we need to be consist in our terminology.
Hm, this feels a lot like a rant..
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--