So how exactly does one make a persistent range object?

Andrej Mitrovic andrej.mitrovich at gmail.com
Mon Jun 6 03:14:03 PDT 2011


On 6/6/11, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> On the whole, I believe that ranges were generally intended to be processed
> and then tossed, which is usually what happens with iterators..

That's what I thought but wasn't sure if that was really the case. I
don't really have a solid C++ background (I've only had a brief
experiment with C++ years ago), and so I've never used iterators. But
I did read Andrei's paper on ranges, and the documentation in
std.range, plus there are some NG posts which show the inception of
the range implementation for D, which I haven't fully read yet. I'm
referring to these:

http://www.digitalmars.com/d/archives/digitalmars/D/announce/RFC_on_range_design_for_D2_12922.html

http://www.digitalmars.com/d/archives/digitalmars/D/announce/Revised_RFC_on_range_design_for_D2_13211.html

They seem like a nice bit of history that could be linked from the
main site, in some sort of 'trivia' section. :)

On 6/6/11, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> So, anything you do on your own could be polymorphic, but as soon as you get ranges from Phobos, you lose the polymorphism.

Yeah, I've noticed that. I wouldn't want to loose the ability to call
into std.algorithm/std.range or even Philippe's dranges library, which
looks really neat. I guess I can use take() on a range and then
array() to get the underlying type which I could easily pass to other
functions. I'll see what I can come up with as I experiment with these
features.


More information about the Digitalmars-d-learn mailing list