From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA02178; Thu, 7 Feb 2002 13:25:33 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA02419 for ; Thu, 7 Feb 2002 13:25:32 +0100 (MET) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g17CPV903330 for ; Thu, 7 Feb 2002 13:25:31 +0100 (MET) Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.9.3/8.9.3/Debian 8.9.3-21) id NAA01441; Thu, 7 Feb 2002 13:25:25 +0100 Date: Thu, 7 Feb 2002 13:25:25 +0100 From: Markus Mottl To: Alain Frisch Cc: Caml list Subject: Re: [Caml-list] Type variables (was: Odd Type Checking Problem) Message-ID: <20020207122525.GB22578@fichte.ai.univie.ac.at> Mail-Followup-To: Alain Frisch , Caml list References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.26i Organization: Austrian Research Institute for Artificial Intelligence Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 ();; [snip] > 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: http://caml.inria.fr/archives/200107/msg00223.html 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 happening). 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 Set-implementation. Regards, 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