Larry wrote:

: 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...  :-)
A practical argument in its favour is that it makes circular-lists-via-modulo:

	@list[++nextidx%7] = $nextval;

and cyclic-value-mapping-via-modulo:

	$day_name = <<Sun Mon Tue Wed Thu Fri Sat>>[$day%7];

both work correctly.


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...);
Surely, that would be:

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

???

Damian

Reply via email to