Change representation of dynamic arrays?
Oskar Linde
oskar.lindeREM at OVEgmail.com
Sun Oct 21 00:25:44 PDT 2007
BCS wrote:
> if the return of .length is left unrestricted, then you can play games
> with having it return a proxy type that another opIndex then uses.
Yes, it doesn't have to be more complicated than so. That would handle
the multidimensional case as well. Possibly let $ -> opDollar() instead
of length(). Then, all we need is to make a..b turn into a special range
type and depreciate opSlice.
The remaining problem would be that while .length always explicitly
refers to an object. $ only does that implicitly within index
operations. A global _dollar() would solve that and allow:
auto a = 1 .. $-1;
auto b = $-5 .. $;
auto c = myObj[a,b];
But that might be too much to ask for.
--
Oskar
More information about the Digitalmars-d
mailing list