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 RAA16255 for caml-redistribution; Mon, 9 Feb 1998 17:03:58 +0100 (MET) 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 PAA14171 for ; Mon, 9 Feb 1998 15:22:05 +0100 (MET) Received: from cri.ens-lyon.fr (cri.ens-lyon.fr [140.77.1.32]) by nez-perce.inria.fr (8.8.7/8.8.5) with ESMTP id PAA08660 for ; Mon, 9 Feb 1998 15:22:02 +0100 (MET) Received: from ens.ens-lyon.fr (ens [140.77.1.183]) by cri.ens-lyon.fr (8.8.5/8.8.1) with ESMTP id PAA21218; Mon, 9 Feb 1998 15:22:00 +0100 (MET) Received: from vaise.ens-lyon.fr (vaise [140.77.191.110]) by ens.ens-lyon.fr (8.8.5/8.8.0) with ESMTP id PAA00905; Mon, 9 Feb 1998 15:21:59 +0100 (MET) From: Pascal Cuoq Received: (from pcuoq@localhost) by vaise.ens-lyon.fr (8.8.5/8.8.0) id PAA07076; Mon, 9 Feb 1998 15:21:57 +0100 (MET) Message-Id: <199802091421.PAA07076@vaise.ens-lyon.fr> Subject: Re: Re : Weak types ? To: lyclaire@ac-grenoble.fr Date: Mon, 9 Feb 1998 15:21:56 +0100 (MET) Cc: caml-list@inria.fr In-Reply-To: <01bd3330$064565a0$739536c1@pluton.ac.grenoble.fr> from "Moreau" at Feb 6, 98 07:49:10 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: weis > let toto y = > let id x = x in > id id y ;; > > this will be of type 'a ->'a > What is the difference with this : > > let toto = let id x = x in id id ;; > > I thought caml will understand that there is no difference ! > > why does caml make this difference ? the same examples, rewritten: let id = fun x -> x ;; let toto = fun y -> id id y ;; caml: ha, I know the answer to this one : toto is a function. The evaluation of "fun y -> anything" can not create references, so type variables can safely be generalized. let toto = id id ;; caml: hmmm, I wonder what this toto may be... It is the result of an application, and I don't know whether I am qualified to look deeper into the code to check about that. It might be anything, I'd better not generalize variables. About this algorithm, you can think of Caml as of Winnie-the-Pooh : it can answer difficult questions in the particular cases where the answer is obvious (ie, syntactic). Otherwise it doesn't know. Pascal