RFC on range design for D2

Bill Baxter wbaxter at gmail.com
Wed Sep 10 11:54:34 PDT 2008


On Thu, Sep 11, 2008 at 3:33 AM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Bill Baxter wrote:
>>
>> On Thu, Sep 11, 2008 at 2:44 AM, Andrei Alexandrescu
>> Cognitive load...
>> What if I want to write a nice standalone function that takes a
>> pointer to where we are and manipulates it?  I have to pass that
>> function two iterators I suppose?
>
> A function only needing one iterator is a chymera. It can't move it any
> direction. To such a function you pass a pointer or reference to the object
> you want to manipulate directly. What's there to not like about it.

Oops.  I meant two ranges not two iterators there.  There are no
iterators in this world.  What I was after in the above is a function
that somehow gets a) where we are, b) how far back we can go c) how
far forward we can go.    With ranges that seems cumbersome.  With
iterators it's exactly those 3 iterators.

> I think you get a lot more insight by actually sitting down and rewriting a
> part of std.algorithm, and/or write some more meaningful algorithms with
> your abstraction of choice. When I started doing so I had no idea of what
> range primitives I need. And just like you now, I kept on hypothesizing in
> the dark on whether I need this and whether I need that. When you
> hypothesize in the dark the number of primitive things you need really grows
> unbounded, because there's always some unrealized imaginary need you want to
> satisfy. To carry the discussion on equal footing you need to do some of
> that work. Otherwise you will keep on coming with hypothetical situations of
> unverifiable likelihood, and I will have little meaningful retort to put
> forth.

Ok.  There's the ultimatum.  I'll shut up and go to bed now.  :-)

--bb


More information about the Digitalmars-d-announce mailing list