caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Deriving a polymorphic mapping module
@ 1999-12-09 11:20 Mike Spivey
  1999-12-09 21:50 ` Benoit de Boursetty
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Spivey @ 1999-12-09 11:20 UTC (permalink / raw)
  To: caml-list

Given the functor-based Map module in the standard library of OCaml,
is there any way of defining polymorphic mappings, like the old module
provided with Caml Light, that has a polymorphic interface and always
uses the polymorphic compare function?  If not, then this seems to me
to be a weakness in the module system.

Looking at the Hashtbl module, I see that it in fact contains two
completely independent implementations of hash tables, one polymorphic
and one using a functor, so I guess the answer is 'no'.

-- Mike Spivey

----8<--------8<--------8<--------8<--------8<--------8<--------8<----

Mauvaise traduction francaise:

Etant donne la module Map du bibliotheque standardise de OCaml,
existe-t-il aucune facon de definer des mappings polymorphes, comme
l'ancien module map de Caml Light, qui a une interface polymorphe, et
utilise toujours la fonction compare polymorphe?  Si ca n'existe pas,
ce me semble une faiblesse de la systeme de modules.

En regardant la module Hashtbl, je vois qu'il contient en effet deux
implantations des hash tables, l'une polymorphe et l'autre basee sur
un functor.  Donc, je crois que la reponse est 'non'.




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Deriving a polymorphic mapping module
  1999-12-09 11:20 Deriving a polymorphic mapping module Mike Spivey
@ 1999-12-09 21:50 ` Benoit de Boursetty
  0 siblings, 0 replies; 2+ messages in thread
From: Benoit de Boursetty @ 1999-12-09 21:50 UTC (permalink / raw)
  To: Mike Spivey; +Cc: caml-list

Hi,

On Thu, 9 Dec 1999, Mike Spivey wrote:

> Given the functor-based Map module in the standard library of OCaml,
> is there any way of defining polymorphic mappings, like the old module
> provided with Caml Light, that has a polymorphic interface and always
> uses the polymorphic compare function?  If not, then this seems to me
> to be a weakness in the module system.

The same problem has already occured for me, with the Set module.
A change of typing resolves the problem. You can find solutions for Set
and Map at

http://www.stud.enst.fr/~debourse/caml.html

Benoit de Boursetty.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-12-10  7:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-09 11:20 Deriving a polymorphic mapping module Mike Spivey
1999-12-09 21:50 ` Benoit de Boursetty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).