On Thu, Dec 05, 2002 at 02:45:39AM -0800, Michael G Schwern wrote:
: I'm going to ask something that's probably going to launch off into a long,
: silly thread.  But I'm really curious what the results will be so I'll ask
: it anyway.  Think of it as an experiment.
: 
: 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]

How about, because I like it?  You may, of course, see that as a
legacy argument, depending on our relative ages...  :-)

Anyway, that aside, I see no reason why we couldn't have array types
that are explicitly declared with array bases other than 0.  Perhaps
even the built-in types can just take a range property:

    my @array is range(1...);

One could even go so far as to have a pragma that causes all arrays declared
in the current *lexical* scope to be based at 1.  Call it

    use fortran;

or some such...

This is not problematical in the same way that $[ was, since we're
limiting the effect to the current lexical scope.  In fact, speaking
of legacy, you'll recall that the "fix" for Perl 5 was to make

    $[ = 1;

really do a lexically scoped declaration despite having the appearance
of a global assignment.

By the way, I noticed when visiting Uruguay that the elevators number
the floors ...-2, -1, 0, 1, 2..., where 0 is the ground floor, and
basement floors are negative.  Way cool.  Now all we have to do is
convince everyone that the year 1 B.C. is the same as year 0 A.D.,
and 2 B.C. is the same as -1 A.D., and so on.

Larry

Reply via email to