RFC on range design for D2
Manfred_Nowak
svv1999 at hotmail.com
Mon Sep 8 16:56:56 PDT 2008
Andrei Alexandrescu wrote:
> feedback would be highly appreciated
1) Example in "4. Bidirectional range"
Reversing of ranges can be done in constant runtime, but the example
exposes runtime linear in the number of elements.
This might be a hint, that a "6. Reversable Range" might be required,
because a range reversable in constant time requires more space.
2) [left,right][Diff,Union]
Ranges are not sets; therefore not only me might have problems to
capture the idea behind "difference" and "union" on ranges.
Of course one can define whatever one wants, but I would prefer
[sub,snip,cut,split,...][B,E][B,E] (r,s)
I.e. `subBB(r,s)' is the subrange of `r' starting at the beginning of
`r' and ending at the beginning of `s' (including the beginning of `r',
but not including the beginning of `s').
It my be of some worth to include the `B' or `E' as parameters to the
choosen keyword(?) to enable algorithmically accesses:
| sub(B,B,r,s)
instead of `leftDiff( r, s)'
-manfred
--
If life is going to exist in this Universe, then the one thing it
cannot afford to have is a sense of proportion. (Douglas Adams)
More information about the Digitalmars-d-announce
mailing list