On Thu 05 Dec, Michael G Schwern wrote:
> So here's your essay topic:
> 
> Explain how having indexes (arrays, substr, etc...) in Perl 6 start at 0
> will benefit most users.  Do not invoke legacy. [1]
>
> [1] ie. "because that's how most other languages do it" or "everyone is
> used to it by now" are not valid arguments.  Ask any Pascal programmer. :)

Many years ago I was involved with a project where all the software
people reffered to the hardware as planes 0 and 1 (it was a duplicated 
system) and the hardware people always used 1 and 2.  To avoid confusion
we settled on using 0 and 2.

Any way of indexing arrays has its proponents.  Perl currently has the
heavily depreciated $[ to allow playing with this base, changing it has 
nasty affects at a distance.

Long long ago some computer languages did base their arrays at 1 rather
than 0.  Hopefully they are dead now - it led to confusion and bad practices.
But that is a legacy argument.

There was an argument when computer languages were close to the hardware,
when to index an array you added the index (multiplied by the size of
the element) to the base of the array to find what you wanted.  This is
probably insignificant and not an issue today.

To conclude other than a very large legacy argument, there is probably
no strong reason to base arrays at 0 rather than 1.  I would not want to
change.

Richard


-- 
Personal     [EMAIL PROTECTED]            http://www.waveney.org
Telecoms     [EMAIL PROTECTED]  http://www.WaveneyConsulting.com
Web services [EMAIL PROTECTED]            http://www.wavwebs.com
Independent Telecomms Specialist, ATM expert, Web Analyst & Services

Reply via email to