RFC on range design for D2

Michel Fortin michel.fortin at michelf.com
Mon Sep 8 21:42:36 PDT 2008


On 2008-09-08 23:43:11 -0400, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> I like the alternate names quite some. One thing, however, is that head 
> and rear are not near-antonyms (which ideally they should be). Maybe 
> front and rear would be an improvement. (STL uses front and back). 
> Also, I may be dirty-minded, but somehow headNext just sounds... bad 
> :o).

Yeah, pehaps. I mostly wanted a verb, not "frontNext" which seems 
wrong, and "head" is both a noun and a verb so I kept it.

> I like the intersection functions as members because they clarify the 
> relationship between the two ranges, which is asymmetric. I will 
> definitely heed this suggestion. "Until" suggests iteration, however, 
> which it shouldn't be (should be constant time) so maybe "nextTo" or 
> something could be more suggestive.

Well, initially I thought about nextTo, but then it stuck me as also 
meaning "the thing just after", which is not really it. I also though 
about nextUpTo, but that's many capitals to type and many small words 
and I prefered nextUntil even with the downside of sounding like we're 
iterating.

But perhaps we could get rid of next and replace it with a verb.

What about this terminology?

r.frontShift      // conceptually r.front; r.shift
r.putShift(e)     // conceptually r.front = e; r.shift

r.front
r.shift
r.shiftTo(s)
r.shiftAfter(s)

r.back
r.pull
r.pullTo(s)
r.pullAfter(s)

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d-announce mailing list