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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id A81AEBB84 for ; Wed, 28 Jan 2009 19:29:49 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuwEAG8zgEnCTtud/2dsb2JhbACBbstEhUcG X-IronPort-AV: E=Sophos;i="4.37,339,1231110000"; d="scan'208";a="20301955" Received: from 157.219-78-194.adsl-static.isp.belgacom.be (HELO decis.be) ([194.78.219.157]) by mail2-smtp-roc.national.inria.fr with ESMTP; 28 Jan 2009 19:29:49 +0100 X-MDAV-Processed: decis.be, Wed, 28 Jan 2009 19:30:21 +0100 Received: from [192.168.0.30] by decis.be (MDaemon PRO v10.0.3) with ESMTP id md50002264062.msg for ; Wed, 28 Jan 2009 19:30:20 +0100 X-Authenticated-Sender: fplancke@decis.be X-MDRemoteIP: 192.168.0.30 X-Return-Path: fvdp@decis.be X-Envelope-From: fvdp@decis.be X-MDaemon-Deliver-To: caml-list@inria.fr Message-ID: <4980A418.3040003@decis.be> Date: Wed, 28 Jan 2009 19:29:44 +0100 From: =?ISO-8859-1?Q?Fr=E9d=E9ric_van_der_Plancke?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: caml-list Subject: Re: [Caml-list] Warning wished References: <1233150828.7199.213.camel@localhost> <49806746.9030507@tepkom.ru> <1233152896.7199.232.camel@localhost> <49806F33.7090205@tepkom.ru> In-Reply-To: <49806F33.7090205@tepkom.ru> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Reply-To: fvdp@decis.be X-Spam: no; 0.00; plancke:01 emits:01 compiler:01 compiler:01 skipping:01 ocaml:01 wrote:01 integer:01 caml-list:01 constraint:01 int:01 omitted:01 caml:02 btw:03 seems:03 Dmitri Boulytchev wrote: > >> Applying g to 1 you will definitely have f x of type int and you have to >> take care of the returned integer. Unfortunatly caml emits no warning in >> this case (even if I understand why) :(. >> > Sure :) But as far as I understand this warning means "this > non-unit value will definitely be omitted, and this > can be possibly wrong". Under this interpretation the compiler has to > ensure undoubtedly that the value is > always non-unit. > BTW you may (temporarily) change your code into something like > > let f x = [x] > > of even into > > let f x = object method get = x end > > and find all the suspicious places :) > > Best regards, > Dmitri. There's the question of what the compiler _does_, what the compiler _could_ do and what the compiler _should_ do. I don't think "this 'a could be unit" is a good reason for skipping the warning. On the contrary, "this 'a will probably sometimes be a real value" seems a sufficient reason to add a warning. If needed, the programmer can easily suppress the warning by adding "ignore" or adding a ": unit" type constraint (whichever applies). (Remains to see whether adding the warning to OCaml is worth the manwork.) Frédéric