RFC on range design for D2

Benji Smith dlanguage at benjismith.net
Wed Sep 10 17:41:58 PDT 2008


Bill Baxter wrote:
> So far though we don't seem to be able to come up with a good example
> other of where ranges are weak than traversing a list back and forth.
>
> ...
>
> But it is a little fishy that we can't come up with any other example
> besides sliding a bead on a wire back and forth.

I dunno about that.

I can think of lots of examples where the "range" metaphor is an awkward 
interloper between the container and the iteration logic:

maps, sets, bags, markov models, graphs, trees (especially in a 
breadth-first traversal)

The word "range" and the idea of the range "moving", "shrinking", or 
being "empty" only matches my concept of "iteration" if I think strictly 
in terms of sequential containers (arrays, slices, lists, etc).

I think the range methaphor is a very cool way of connecting sequential 
containers with algorithms (especially divide-and-conquer algorithms, 
which seem particularly well-suited to the range metaphor).

But if I want to visit each <p> node in a DOM tree, I have a hard time 
visualizing how a "range" fits into that process.

Maybe it's just terminology. I'm not sure yet.

--benji


More information about the Digitalmars-d-announce mailing list