caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jerome Vouillon <vouillon@clipper.ens.fr>
To: Hugo Herbelin <herbelin@margaux.inria.fr>
Cc: caml-list@inria.fr
Subject: Re: Foncteurs polymorphes
Date: Wed, 27 Aug 1997 18:30:34 +0200 (MET DST)	[thread overview]
Message-ID: <Pine.SUN.3.95.970827175613.16899A-100000@vedette> (raw)
In-Reply-To: <199708251652.SAA24264@margaux.inria.fr>


On Mon, 25 Aug 1997, Hugo Herbelin wrote:

> Cela tient-il la route d'avoir une notion de polymorphisme dans les
> modules qui soit distincte du polymophisme des fonctions qu'il
> contient.

Cela a effectivement un sens, et a d'ailleurs ete deja propose par
Stefan Kahrs (http://www.dcs.ed.ac.uk/home/smk/).

Cependant, pour assurer la correction du typage en presence d'effets
de bords, la technique utilisee par O'caml est de ne generaliser le
type que des expressions qui sont syntaxiquement des valeurs (toutes
les autres techniques compliquent le systeme de type). La quantifi-
cation du type des modules perd beaucoup de son interet si l'on
generalise cette technique aux expressions de module. Ainsi, dans ton
exemple, le module defini par
   module M = Make(struct let compare = Pervasives.compare end)
aurait le type '_a S et non 'a S. En particulier, le type de M.empty
est '_a t, qui n'est pas polymorphe.

-- Jerome Vouillon

>   Exemple pratique : le foncteur Set.Make.
> 
>   Pourrait-on avoir les types suivants pour le module Set :
> 
>     module type 'a OrderedType =
>       sig
>         val compare: 'a -> 'a -> int
>       end
> 
>     module type 'a S =
>       sig
>         type 'a t
>         val empty: 'a t
>         ...
>      end
> 
>     module Make(Ord: 'a OrderedType) : 'a S
> 
> où la quantification par 'a est maintenant sur Make (i.e. Make a le
> type explicitement quantifié "FORALL 'a. 'a OrderedType -> 'a S")






  reply	other threads:[~1997-08-28  9:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-08-25 16:52 Hugo Herbelin
1997-08-27 16:30 ` Jerome Vouillon [this message]
1997-08-28  9:34 ` Emmanuel Engel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.SUN.3.95.970827175613.16899A-100000@vedette \
    --to=vouillon@clipper.ens.fr \
    --cc=caml-list@inria.fr \
    --cc=herbelin@margaux.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).