On Iteration
Lutger
lutger.blijdestijn at gmail.com
Tue Nov 10 02:18:59 PST 2009
Andrei Alexandrescu wrote:
> I consider changing a bit D's range model following the better
> understanding reflected in this article:
>
> http://erdani.com/publications/on-iteration.html
>
> If you have any thoughts and if you can help with the implementation,
> please let us know.
>
>
> Andrei
I thoroughly enjoyed the article, thank you in particular for making this
material accessible to non computer scientists like myself.
More questions than thoughts if I may, do feel free to ignore them, these
are just things I wonder about:
- how to do ranges over a tree?
My first thought was that a tree would define preorder / inorder / postorder
ranges, and then perhaps visitors for more complex algorithms. But in the
'iterators must go' keynote you mentioned implementing traversal over trees
by popFront() taking a parameter indicating the branch to go to. Can you or
anybody else shed more light on how this will work out? What about graphs?
- ranges over immutable data structures
I tried making an immutable linked list and stack (not as simple as I
thought) with range support. Ranges must be mutable though. So I take it
that ranges are not usually supposed to be shared, rather they be
consumable, local views into immutable data structures instead?
This leads to a broader question: is it possible to model some support for
concurrency in ranges? So that algorithms can possibly choose a particular
implementation based on the concurrent properties of a range? Perhaps this
relates to the separation between iteration and access as well.
- why is a UTF-string iterator bidirectional and why is that unexpected?
- Is there already a standard way to implement a default range for a
container?
I have tons more questions, but I'll try to work them out for myself first
or post them in .learn.
More information about the Digitalmars-d
mailing list