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 JAA18258; Thu, 9 Aug 2001 09:11:09 +0200 (MET DST) 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 JAA18313 for ; Thu, 9 Aug 2001 09:11:08 +0200 (MET DST) Received: from pochi.inria.fr (pochi.inria.fr [128.93.8.128]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f797Ai510486; Thu, 9 Aug 2001 09:10:44 +0200 (MET DST) Received: (from mentre@localhost) by pochi.inria.fr (8.11.1/8.10.0) id f797Ai907415; Thu, 9 Aug 2001 09:10:44 +0200 X-Authentication-Warning: pochi.inria.fr: mentre set sender to David.Mentre@inria.fr using -f To: JayR Cc: caml-list@inria.fr Subject: False polymorphic (was: Re: [Caml-list] native code debugging) References: <4.3.2.7.2.20010808113426.02901510@shell16.ba.best.com> <3B71E904.4016B6E7@home.com> From: David Mentre Date: 09 Aug 2001 09:10:44 +0200 In-Reply-To: <3B71E904.4016B6E7@home.com> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk JayR writes: > # let id x = x;; > val id : 'a -> 'a = This expression is fully polymorphic. # id 7;; - : int = 7 # id "w";; - : string = "w" > # let id2 = id id;; > val id2 : '_a -> '_a = This one is not (notice the underscore (_) before the type variable a). It is a monomorphic type that is right know unknown but will be determined at first instantiation. > # id2 7;; > - : int = 7 # id2;; - : int -> int = You see, you now have int instead of '_a. > # id2 "w";; > This expression has type string but is here used with type int So of course the type does not match with a string parameter. For further information on this subject, have a look at the FAQ: http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#variables_de_types_faibles Best regards, d. -- David.Mentre@inria.fr Opinions expressed here are only mine. ------------------- 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