Revised RFC on range design for D2

Sergey Gromov snake.scaly at gmail.com
Fri Sep 12 09:07:21 PDT 2008


Bill Baxter <wbaxter at gmail.com> wrote:
> On Fri, Sep 12, 2008 at 11:58 PM, Sergey Gromov <snake.scaly at gmail.com> wrote:
> >>
> >> So basically you changed
> >> done ==> empty
> >> head ==> tip
> >> retreat ==> prev
> >> ?
> >
> > The insight was about get/put ==> next.  That's the most significant
> > change, others are merely renames as you rightfully point out.  Hence
> > the "prev" which should mean both "get at the end" and "put to the end".
> 
> Ah ok.  Your switching to declaration syntax instead of usage syntax
> confused me. :-)
> 
> That is cute.  So
>    r.put(e) ==> r.next = e
> It would also mean the copy to output idiom would become
> 
> for(; ! i.done; i.next)
>    o.next = i.head;
>
> Would be cooler if it could be just while(!i.done) o.next = i.next;
> .. oh well.

Exactly, I wanted it to be

while (!i.done)
    o.next = i.next;

because I didn't want any head in an input range.

> But maybe it's too cute for too little gain?  It's pretty darn obvious
> what a "put" function is for.  you can also search for it more easily
> then a bunch of next's that could be either writes or not writes.

I'm still not sure.  The usability can only be measured by actual usage.


More information about the Digitalmars-d-announce mailing list