Revised RFC on range design for D2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Sep 12 10:44:53 PDT 2008


Sergey Gromov wrote:
> 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;

Hmm, let's see. So:

a) If i is an input range, then i.next returns by value.

b) If i is a forward range, then i.next returns by reference.

I assume that's what you had in mind?


Andrei


More information about the Digitalmars-d-announce mailing list