Version française
Home     About     Download     Resources     Contact us    
Browse thread
Deriving a polymorphic mapping module
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Mike Spivey <mike@c...>
Subject: Deriving a polymorphic mapping module
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'.