From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 1ABF47EEFA for ; Thu, 12 Nov 2015 21:16:12 +0100 (CET) IronPort-PHdr: 9a23:pUOzTBc//5awsf40npuPA5a3lGMj4u6mDksu8pMizoh2WeGdxc6+ZR7h7PlgxGXEQZ/co6odzbGG7ua8CCdZus3JmUtBWaIPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbviptuPMk4R32H1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu2pN5g/GLdRCTBjN2Eu+OXqswPCRE2B/CgySGITxzpFBQTf7RKydJD2t2Outud71DObPuXqSqgzWHK66KByDhTvjXFUZHYC7GjLh5ko3+pgqxW7qkknzg== Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=hendrik@topoi.pooq.com; spf=None smtp.mailfrom=hendrik@topoi.pooq.com; spf=None smtp.helo=postmaster@april.topoi.pooq.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of hendrik@topoi.pooq.com) identity=pra; client-ip=69.165.131.134; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="hendrik@topoi.pooq.com"; x-sender="hendrik@topoi.pooq.com"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of hendrik@topoi.pooq.com) identity=mailfrom; client-ip=69.165.131.134; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="hendrik@topoi.pooq.com"; x-sender="hendrik@topoi.pooq.com"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@april.topoi.pooq.com) identity=helo; client-ip=69.165.131.134; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="hendrik@topoi.pooq.com"; x-sender="postmaster@april.topoi.pooq.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DKBwAT80RW/4aDpUVehFcBJYJfvVOGEAKBexABAQEBAQEBAYEJgi2CCAEBBCMPAVYLGAICBSECAg8FGESILrNakGEBAQEHAQEBAR+BAYpRhSeCTi+BFQWOEYg3jR8IXX6SFoRig3I4K4QiIDSFPQEBAQ X-IPAS-Result: A0DKBwAT80RW/4aDpUVehFcBJYJfvVOGEAKBexABAQEBAQEBAYEJgi2CCAEBBCMPAVYLGAICBSECAg8FGESILrNakGEBAQEHAQEBAR+BAYpRhSeCTi+BFQWOEYg3jR8IXX6SFoRig3I4K4QiIDSFPQEBAQ X-IronPort-AV: E=Sophos;i="5.20,283,1444687200"; d="scan'208";a="153639824" Received: from topoi.pooq.com (HELO april.topoi.pooq.com) ([69.165.131.134]) by mail3-smtp-sop.national.inria.fr with ESMTP; 12 Nov 2015 21:16:09 +0100 Received: by april.topoi.pooq.com (Postfix, from userid 1001) id 761F31A03B9; Thu, 12 Nov 2015 15:16:07 -0500 (EST) Date: Thu, 12 Nov 2015 15:16:07 -0500 From: Hendrik Boom To: caml-list@inria.fr Message-ID: <20151112201607.GC30724@topoi.pooq.com> References: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3F4C5@IRSMSX102.ger.corp.intel.com> <5644845B.6000801@freenet.de> <9463C955F1814F02BE3D330F5C3E4E17@erratique.ch> <0F7D3B1B3C4B894D824F5B822E3E5A172CE3F675@IRSMSX102.ger.corp.intel.com> <1457A4B3A2894AC0858EE7C5FCBA3D7F@erratique.ch> <1447346244.4108313.438013625.74F09F5B@webmail.messagingengine.com> <1FC1AC75A2AB4C22B73E890AAF747F6D@erratique.ch> <1447356106.28343.15.camel@zotac> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1447356106.28343.15.camel@zotac> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [Caml-list] Suppress warning from within Ocaml source file On Thu, Nov 12, 2015 at 08:21:46PM +0100, Gerd Stolpmann wrote: > Am Donnerstag, den 12.11.2015, 19:39 +0100 schrieb Virgile Prevosto: > > 2015-11-12 18:26 GMT+01:00 Daniel Bünzli : > > > Le jeudi, 12 novembre 2015 à 16:37, Leo White a écrit : > > >> > This misses the point. By using `with` I can instruct the compiler that I don't want my program not to compile if I add or remove fields. In the current system I can do this with any update I want to make to a record except if for some strange reason that update happen to touch all the current fields of the record. > > >> > > >> I don't particularly wish to argue for or against using this warning, but I think it is worth noting > > >> that this is not really any different from: > > > > > > […] > > > > > > It's quite different: you have dead code in your example. > > > > > > > But in the record case, the expr in { expr with ... } will indeed be > > evaluated (thus is not dead), but its result will never be used, which > > is barely better. In the (admittedly contrived) example below, > > investigating the cause of the warning would save you from a runtime > > exception: > > > > type foo = { a : int; } > > let rec x = lazy { a = (Lazy.force x).a } > > let y = { (Lazy.force x) with a = 42 } > > > > Now that I think of it, it is more like warning 26, with the exception > > that in the present case, the expression is usually a variable and > > thus already evaluated. > > Maybe print the warning only in the non-variable case? And rephrase the > warning to "the expression before 'with' is not evaluated"? Isn't this message also misleading? Isn't the expression evaluated even though its value ignored? This could show up f it has side effects. -- hendr9ik