From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.5 required=5.0 tests=AWL,RCVD_NUMERIC_HELO, SPF_SOFTFAIL,UNPARSEABLE_RELAY autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 349DBBB84 for ; Wed, 28 Jan 2009 15:23:13 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkgCAJv4f0mEpqxqnGdsb2JhbACJGopYHAEBAQEBCAsICRFNtxqFRwaCUw X-IronPort-AV: E=Sophos;i="4.37,338,1231110000"; d="scan'208";a="20286368" Received: from cirse-out.extra.cea.fr ([132.166.172.106]) by mail2-smtp-roc.national.inria.fr with ESMTP; 28 Jan 2009 15:23:12 +0100 Received: from nephilia.intra.cea.fr (nephilia.intra.cea.fr [132.166.88.33]) by cirse.extra.cea.fr (8.14.2/8.14.2/CEAnet-Internet-out-1.2) with ESMTP id n0SENCSE029801; Wed, 28 Jan 2009 15:23:12 +0100 Received: from muguet1.intra.cea.fr (muguet1.intra.cea.fr [132.166.192.6]) by nephilia.intra.cea.fr (8.13.8/8.13.8) with ESMTP id n0SENCuw025108; Wed, 28 Jan 2009 15:23:12 +0100 (envelope-from julien.signoles@cea.fr) Received: from levau.intra.cea.fr (levau.intra.cea.fr [132.166.88.52]) by muguet1.intra.cea.fr (8.13.8/8.13.8/CEAnet-Intranet-out-1.1) with ESMTP id n0SENBW7016624; Wed, 28 Jan 2009 15:23:11 +0100 Received: from LAXA.intra.cea.fr ([132.166.64.44]) by levau.intra.cea.fr with Microsoft SMTPSVC(6.0.3790.3959); Wed, 28 Jan 2009 15:23:11 +0100 Received: from 132.166.135.80 ([132.166.135.80]) by LAXA.intra.cea.fr ([132.166.64.53]) with Microsoft Exchange Server HTTP-DAV ; Wed, 28 Jan 2009 14:23:11 +0000 Received: from is005140 by LAXA.intra.cea.fr; 28 Jan 2009 15:24:14 +0100 Subject: Re: Re : [Caml-list] Warning wished From: Julien SIGNOLES To: Matthieu Wipliez Cc: caml-list In-Reply-To: <739317.49579.qm@web27001.mail.ukl.yahoo.com> References: <1233150828.7199.213.camel@localhost> <739317.49579.qm@web27001.mail.ukl.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Organization: CEA LIST Date: Wed, 28 Jan 2009 15:24:14 +0100 Message-Id: <1233152654.7199.227.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-OriginalArrivalTime: 28 Jan 2009 14:23:11.0572 (UTC) FILETIME=[F2FD3940:01C98153] X-Spam: no; 0.00; signoles:01 signoles:01 matthieu:01 bug:01 compiler:01 unify:01 2009:98 emit:01 caml-list:01 cea:01 caml:02 caml:02 seems:03 unit:03 unit:03 Le mercredi 28 janvier 2009 =E0 14:07 +0000, Matthieu Wipliez a =E9crit : > > Hello, > >=20 > > Is it a bug or a well-known feature that the above program does not emi= t > > a warning (because "f x" should have type unit in the body of "g") ? > >=20 > > =3D=3D=3D=3D=3D > > let f x =3D x > > let g x =3D f x; 1 > > (* let _ =3D g 2 *) > > =3D=3D=3D=3D >=20 > I'm not familiar with the internals of the compiler, but what I suppose i= s happening is that it tries to unify the type of "f x" and "unit", and thi= s succeeds because "f x" has type 'a, which can be unified with anything. T= he meaning of "a;b" seems to be let _ =3D a in b rather than let () =3D a i= n b. >=20 > But like I said, these are suppositions. Sure. However in my real case, I had an "ok" code like this : let f x : 'a -> unit =3D ... let g x =3D f x; x I changed a little bit the specification of f : let f x : 'a -> 'a =3D ... I just expected that caml helps me to find all the instances where I had to take care of this specification change. Such a thing is one of the very good features of caml. Unfortunatly, in this case, caml did not help me while the old implementation of "g" became wrong with the new specification of "f" :-(. -- Julien