Revised RFC on range design for D2
Benji Smith
dlanguage at benjismith.net
Thu Sep 11 23:46:03 PDT 2008
Andrei Alexandrescu wrote:
> In wake of the many excellent comments and suggestions made here, I made
> one more pass through the draft proposal for ranges.
>
> http://ssli.ee.washington.edu/~aalexand/d/tmp/std_range.html
>
> There are some comments in red illustrating some uncertainties (not
> all), and the names of the primitives have been updated. Bicycle shed
> galore! But don't forget to comment on the reactor as well :o).
Well done. I think the design has come together very nicely. I'm
especially happy with all the new names, which make a big difference for
me in being able to visualize how the proposal works. The old names
(fromLeft, etc) were very opaque to me.
(btw: head & toe? i love it!)
In its current state, this actually gets me pretty excited about D2.
Maybe even enough to finally slog my way through all the const stuff.
One tiny typo, though: In the "Forward range" section, the code sample
still uses "left" instead of "head".
And, there are two sections (which I think are related to one another)
that left me scratching my head:
Input Ranges:
"In case ElementType!(R) has aliases (such as a reference, pointer, or
array type), the iterator is free to recycle it it upon the call to
r.next, so client code must do a deep copy if preserving the value is
needed. [NOTE: This is a weakness in the design. A better way of
figuring recycling should be found.] The call is defined only right
after r.done returned false."
Forward Ranges:
"Also, forward ranges iterate over "real" elements, which makes in-place
mutation of r.head possible."
Those paragraphs are completely greek to me. Can you elaborate?
--benji
More information about the Digitalmars-d-announce
mailing list