Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] [ANN] The Missing Library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] [ANN] The Missing Library
> On Wed, 2004-04-28 at 22:36, Nicolas Cannasse wrote:
>
> > There is ExtLib Enum.map that's pretty good at doing that.
>
> Yes indeed. Extlib enums are very promising.
>
> > That's exactly the same as ExtLib enums : define an enumerator for your
data
> > structure, and you can apply a full range of algorithms on it. I don't
> > really understand the difference with  STL.
>
> I think there are a couple of differences.
>
> First, Extlib enums are weaker than STL iterators abstractly.
> An enum is a single object representing the *tail* of an enumeration.
> An STL iterator represents a *position*. Thus for example
> two STL iterators represent the tail of an enumeration.
> This is much more powerful (and also less safe dynamically).
> STL iterators can also be used to denote insertion points,
> result of a search, etc.

Such comparison  tail = end , is also well fitted for the C++ world, where
in general NULL is the end of everything, and operator overloading helps
here a lot. Just one question : what is the excepted behavior of equality
between two iterators coming from two different data structures - both
containing the same type of elements ? What about equality between two
iterators over two different dynamic arrays ? Is the first iterator
index-bounded by the second array (the one it's not itering on) ?

> Secondly, the semantics of STL iterators are more refined
> and better specified. There are several classes of STL
> iterators (input, output, forward, bidirectional, ..).
> Also the invalidation conditions are dealt with
> in detail. STL iterators also have minimum laziness
> of one value..the laziness of enums is not quite
> so well defined... recall I had some problems
> with the specifications and still do.

Please state clearly your problems on the ExtLib mailling list, I will be
happy to think about theses :)
Enums are still young so there not yet specialized enums that can  remove
elements while itering or give random access. Maybe in the future...

Best Regards,
Nicolas Cannasse

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners