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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] Re: generic programming
Chris Hecker wrote:

>
> I need to look at Francois' solution, so I'm not sure yet. 

It's semantically equivalent to input iterators, though the syntax is 
different,
and it misses the ability to iterate over a range with a specified endpoint.
More general iterators need a more sophisticated interface, but the 
technique
can be generalised to returning a tuple of closures [deref, increment, 
compare,
etc, rather than just 'next'] (effectively, a set of
methods on the object which is the state encapsulated in the function:
the usual functional tricky to get object orientation for free :-)

> I'm actually not running into a problem right now with this anyway, so 
> it's academic for me at this point, it was just something I've been 
> wondering about since I started learning caml and was mentally 
> comparing it to C++'s templates.  I haven't thought about the issues 
> thoroughly, but maybe John Max Skaller can comment on whether 
> Francois' iterators are "good enough" for what he was trying to write. 

heh! It's academic for me too.
I was just curious if I could build a version of STL for Ocaml.

-- 
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850




-------------------
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