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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 7936DBB84 for ; Wed, 28 Jan 2009 17:57:10 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjABAG0dgElCbwQdlGdsb2JhbACUDgEBAQEJCwgJEQS4WoVHBg X-IronPort-AV: E=Sophos;i="4.37,339,1231110000"; d="scan'208";a="22154039" Received: from unknown (HELO out5.smtp.messagingengine.com) ([66.111.4.29]) by mail3-smtp-sop.national.inria.fr with ESMTP; 28 Jan 2009 17:57:05 +0100 Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.fastmail.fm (Postfix) with ESMTP id 996D325E91A; Wed, 28 Jan 2009 11:56:53 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 28 Jan 2009 11:56:53 -0500 X-Sasl-enc: 8miw6MLT0GKWE++CA/KKkiWaB53FOYshbPWNXzpWAEjY 1233161813 Received: from [192.168.1.10] (ALyon-157-1-26-173.w86-193.abo.wanadoo.fr [86.193.117.173]) by mail.messagingengine.com (Postfix) with ESMTPSA id C66CC2D0E1; Wed, 28 Jan 2009 11:56:52 -0500 (EST) Message-ID: <49808DEC.3030802@ens-lyon.org> Date: Wed, 28 Jan 2009 17:55:08 +0100 From: Martin Jambon User-Agent: Thunderbird 2.0.0.17 (X11/20081008) MIME-Version: 1.0 To: Julien SIGNOLES Cc: caml-list Subject: Re: [Caml-list] Warning wished References: <1233150828.7199.213.camel@localhost> In-Reply-To: <1233150828.7199.213.camel@localhost> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ens-lyon:01 signoles:01 bug:01 compiler:01 command-line:01 enforces:01 annotations:01 camlp:01 camlp:01 syntax:01 wrote:01 emit:01 caml-list:01 jambon:01 jambon:01 Julien SIGNOLES wrote: > Hello, > > Is it a bug or a well-known feature that the above program does not emit > a warning (because "f x" should have type unit in the body of "g") ? > > ===== > let f x = x > let g x = f x; 1 > (* let _ = g 2 *) > ==== The compiler could have a command-line switch that enforces the unit type in sequences, i.e. it would add type annotations for you: let f x = x let g x = (f x : unit); 1 There's a camlp4/camlp5 syntax extension that does this (but I don't use it). Martin -- http://mjambon.com/