opSlice and $

Janice Caron caron800 at googlemail.com
Tue Sep 11 13:29:06 PDT 2007


> I dont know even what signature it will have, how to distinguish such
> uses:
> c[1, 2..3]
> c[1..2,3]

Just a suggestion, but the signature could be

opSlice(int[] ...)

where the passed array always had an even number of parameters, and
non-slice parameters get passed as the tuple n, n+1. In that case,
your two cases would be distinguished as [ 1, 2, 2, 3 ] and [ 1, 2, 3,
4 ] (since 1 is equivalent to 1..2, and 3 is equivalent to 3..4).

Only works for ints, but hey! Better than nothing.



More information about the Digitalmars-d mailing list