RFC on range design for D2

Sergey Gromov snake.scaly at gmail.com
Wed Sep 10 11:05:38 PDT 2008


Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> David Gileadi wrote:
> > Sergey Gromov wrote:
> >> If you draw a parallel between a range and a stack of paper, the 
> >> shrink methods would probably be pop/snap...  I'd also propose next() 
> >> for moving the start and prev() for moving the end.  It sounds a bit 
> >> misleading but, on the other hand, it closely resembles forward and 
> >> backward iteration with the opposite end of a range representing the 
> >> iteration limit.  Or maybe forward()/backward(), or fwd()/back()?
> > 
> > Perhaps reduce() instead of pop() for moving the end?
> 
> I love reduce! Thought of it as well. Unfortunately the term is loaded 
> with reduction of a binary operation over a range, as e.g. in std.algorithm.
> 
> I think shrink() is reasonable. next() moves to the next thing. shrink() 
> shrinks the set of dudes I can reach.

I thought of next/shrink as well, but they look asymmetrical, and also 
next here is a form of shrink, too.  Someone could think of "shrink" as 
of chopping from both ends.


More information about the Digitalmars-d-announce mailing list