Proposal: Multidimensional opSlice solution

bearophile bearophileHUGS at lycos.com
Mon Mar 8 18:49:58 PST 2010


Norbert Nemec:
> Just note that the slice operator "a..b" 
> should also allow strided slicing "a..b:c"

I have asked for this ages ago :o) But at that time there was no laziness and ranges in Phobos, so that was not very useful.


> Yea, seems like I missed some important decisions. May indeed be too 
> late for some ideas. Still - not giving up quite yet.

D won't be frozen forever, eventually few new things will be added, for example in D3. For example probably some of the limits of CTFE will be removed. Even C language and Fortran keep having changes every ten years or so.
What will be hard to do are changes/removals. It's important to tell apart additive changes (like the ones you ask, like using 0 and $ as default bounds when they are missing, or adding a stride) from breaking changes (like replacing .. with a : ). I didn't understand this essential difference until too much late.


> Admitted, the last case does not work quite as nicely with ".." as it 
> does with Python's ":". Still, the point should be clear.

I have never understood why Walter has adopted .. for slices instead of the better :
I'd like to know why.

Bye,
bearophile



More information about the Digitalmars-d mailing list