> we are after SIMPLE syntax. This means like C, Fortran, IDL and Matlab.
> Perl is about working like most people expect.
>
Yes, we are after simple syntax. We also want to make to hard things
possible. Therefore we want a syntax that is also flexible.
> To access a single element we want
>
> $a[$i,$j,$k]
>
But this already means "the $i, $j, and $k" elements of a list. It is a very
frequently used construct--I think that changing it will be impossible, and
that creating a new data type that acts contrary to this would be highly
confusing.
> for a slice we want
>
> $a[10:20:2, 11:30:3]
>
As opposed to:
$a[[10:20:2], [11:30:3]]
which is only four keystrokes. Maybe we could define circumstances under
which list generation notation is automatically enreferenced, and then your
preferred notation would work too...
>
> Replace "," and ":" with your favourite punctuation stop, and "[]" with
your favourite
> brackets. $a might be @a in the slice context. I don't really care about
> these choices as long as one of them is made. I'll even live with the ";"
> rather than this:
>
> > $b = $a[[0,1]]; # $b == 1
>
> which is too much unneccessary typing.
>
But it's only two more (repeated!) chars than
$b = $a[0,1]; # $b == 1
Furthermore, this syntax avoids the aforementioned ambiguity with multiple
indexing, is naturally extended to selecting multiple points, and because
the index is just a list of lists it allows functions or other lists to be
used to index directly. It seems like enough wins to get over having to
double-tap the square bracket.
Not that you would have to do much double-tapping anyway--normally your
slice will be in another array, and you won't need to explicitly loop very
much because of the implicit looping provided by list context operations.
> I have no problems with $a[$i][$j][$k] as an alias.
>
How about for multiple indexes?:
@foo[0,3][1,4][2,5]
as an alias for:
@foo[[0,1,2], [3,4,5]]; # True