On Sat, Sep 04, 2004 at 09:47:29AM +0200, Leopold Toetsch wrote:
: Honestly I don't see the point why all "normal" array usage should be
: slowed down just for the sake of some rare usage patterns.

Another possibility is that .[] always forces the "normal" view of an
array as 0-based, and if you want non-0-based arrays you have to use
the .{} interface instead, on the assumption that strange subscripts
are more like hash keys than ranges of integers.  Certainly if
you have a sparse array with keys like 1,2,4,8,16,32... you have a
situation that's more like a hash than an array.  A sparse array
might not even give you the .[] interace.  The presence of a .[]
interface might signal the ability to process contigous ranges,
even if those ranges are offset from the .{} range.

Such an approach would have the benefit that a module could simply
treat all its arrays as 0-based .[] arrays, and if you happened to
pass a non-0-based .{} array in, it would still work, albeit with
0-based indexes instead of whatever shape the .{} interface uses.

Anyway, it's an idea that might or might not make sense.  It seems
to me, though, that either you're interested in treating all the
dimensions of a subscript as non-0-based, or none of them.  I think
people will rarely want to mix those in the same subscript.

On the other hand, it opens up the possibility of mixing up .[] with .{}
and getting off-by-n errors, unless a declared shape of non-0-based
turns off the .[] interface entirely.

Larry

Reply via email to