English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Odd Type Checking Problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-02-07 (12:25)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] Type variables (was: Odd Type Checking Problem)
On Thu, 07 Feb 2002, Alain Frisch wrote:
> Actually, I feel myself somewhat confused with implicit introduction and
> scoping of type variables.
> These one are refused:
> let f (x : 'a) = let module M = struct exception X of 'a end in ();;
> let f (x : 'a) = let module M = struct type t = 'a end in ();;
> Is there a way to use a type variable such as the 'a above to define
> types in a local structure ?

This issue has already popped up in the past. See, for example:


There is unfortunately no way (yet) to use type variables in the way
shown above. When there is a type variable in a type definition, the type
checker will look for a binding at the level of the type definition,
not any further (I hope this explanation comes close to what is really

Are there any plans to lift this restriction? This would e.g. allow using
polymorphic types in functor arguments that expect monomorphic instances,
because the free variable could be bound in an outer scope. For instance,
one could create "polymorphic" sets of elements with the already existing

Markus Mottl

Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr