Short list with things to finish for D2

bearophile bearophileHUGS at lycos.com
Sat Nov 28 05:24:04 PST 2009


Stewart Gordon:
> Only for built-in linear arrays.  Half the point is: What if somebody 
> creates a type for which the lower bound is something different?

This can be useful. For example an array with indices in a .. z+1 :-)


> maybe we need some symbol like ^ to denote the lower 
> bound, and opLowerBound to implement it.  (I've picked ^ along the lines 
> of regexps, from which $ is presumably derived.  I *think* this doesn't 
> lead to any ambiguity....)

In Python you usually just omit the value:
a[:5] === a[0 .. 5]
a[5:] === a[5 .. $]
Or you can also use None, this can useful because you can put None inside a variable, etc (while in D you can't put $ inside a variable to represent "the end of that array"):
a[None:5] === a[0 .. 5]
a[5:None] === a[5 .. $]

Bye,
bearophile



More information about the Digitalmars-d mailing list