From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA11214 for caml-redistribution; Tue, 1 Jun 1999 17:13:55 +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 MAA02434 for ; Mon, 31 May 1999 12:37:42 +0200 (MET DST) Received: from lri.lri.fr (lri.lri.fr [129.175.15.1]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id MAA25958 for ; Mon, 31 May 1999 12:37:40 +0200 (MET DST) Received: from pc89.lri.fr (pc89.lri.fr [129.175.8.108]) by lri.lri.fr (8.9.1a/8.9.1) with ESMTP id MAA14162; Mon, 31 May 1999 12:37:40 +0200 (MET DST) Received: by pc89.lri.fr (8.8.7/feuille) id MAA32754 ; Mon, 31 May 1999 12:37:39 +0200 X-Authentication-Warning: pc89.lri.fr: filliatr set sender to filliatr@pc89.lri.fr using -f From: Jean-Christophe Filliatre MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14162.26227.300552.10117@pc89.lri.fr> Date: Mon, 31 May 1999 12:37:39 +0200 (MEST) To: aXl Cc: caml-list@inria.fr Subject: Re: Typing-problem In-Reply-To: References: X-Mailer: VM 6.49 under Emacs 20.3.1 Reply-To: Jean-Christophe.Filliatre@lri.fr (Jean-Christophe Filliatre) Content-Transfer-Encoding: 7bit Sender: weis > why is in the following example b of type "string -> string" ? > > let a = id id;; > let b = a;; > a "foo";; > (* until here it's covered by the faq's *) > b;; It is because: 1. the type variable is not generalized is the type of a; (it is '_a -> '_a) 2. that type variable is shared between the types of a and b Therefore when applying a to "foo", that type variable is instanciated by string, which instanciates also the type of b. A more detailed explanation is given here : http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#polymorphisme Best regards, -- Jean-Christophe FILLIATRE mailto:Jean-Christophe.Filliatre@lri.fr http://www.lri.fr/~filliatr