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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Brown <caml-list@d...>
Subject: Re: [Caml-list] Functors
On Sun, May 02, 2004 at 06:24:15PM +0800, Martin Jambon wrote:

> With my words: I understand functors as a way to parametrize a type with a
> value.
> They allow you to detect inconsistencies at compile time (e.g. 2 sets
> parametrized with different "compare" functions).
> Without functors, as far as I know, you can only test inconsistencies at
> run time (e.g. by putting all the parameters in a record an check physical
> equality of the records).

Unless the compare function is only an argument of the set creation
routine, and the value is part of the set itself.  There might be
performance issues with an extra field, though.

Dave

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