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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id BCA4F7F616 for ; Wed, 22 Feb 2017 21:10:52 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=aymeric.fromherz@ens.fr; spf=Pass smtp.mailfrom=aymeric.fromherz@ens.fr; spf=None smtp.helo=postmaster@nef2.ens.fr Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of aymeric.fromherz@ens.fr) identity=pra; client-ip=129.199.96.40; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="aymeric.fromherz@ens.fr"; x-sender="aymeric.fromherz@ens.fr"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of aymeric.fromherz@ens.fr designates 129.199.96.40 as permitted sender) identity=mailfrom; client-ip=129.199.96.40; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="aymeric.fromherz@ens.fr"; x-sender="aymeric.fromherz@ens.fr"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@nef2.ens.fr) identity=helo; client-ip=129.199.96.40; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="aymeric.fromherz@ens.fr"; x-sender="postmaster@nef2.ens.fr"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3ADuDy4xKa+96OwabRO9mcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgUKvzxwZ3uMQTl6Ol3ixeRBMOAuq8C0rSd6vu7ESxYuNDa7yBEKMQNHzY+yu?= =?us-ascii?q?wo3CUYSPafDkP6KPO4JwcbJ+9lEGFfwnegLEJOE9z/bVCB6le77DoVBwmtfVEt?= =?us-ascii?q?fre9LLXPlNy63Pye/JjaYgMAxGbsIOA6EBLjpgzUsowSgJB+Aqc30BrA5HVSKM?= =?us-ascii?q?pMwmY9DEOWkgz97Y+e5plm8ylKqbp1/t9FXL/7dOI2V7tdDDk8IUg44tatuwOV?= =?us-ascii?q?HljH3WcVTmhDykkAOAPC9hyvAsb8?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AXAwD77q1Yhyhgx4FdGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBFQEBAQECAQEBAQgBAQEBhAcDgQYBg1qKepBogjqVByqFeAKDB0MUAQE?= =?us-ascii?q?BAQEBAQEBAQESAQEBCA0JCh0vgjMEAwMdghcBBSNLChELGAICBQQSCwICCQMCA?= =?us-ascii?q?QIBMxITBgIBAQ6JSwMVBQmvLIImhz4Dg3QBCgEBASSBC4VBhG+EQl6COoJfBYc?= =?us-ascii?q?4DJRMa4EXhHKNfY5CkyU2gSE1I0+EXIFudIhZgTsBAQE?= X-IPAS-Result: =?us-ascii?q?A0AXAwD77q1Yhyhgx4FdGgEBAQECAQEBAQgBAQEBFQEBAQE?= =?us-ascii?q?CAQEBAQgBAQEBhAcDgQYBg1qKepBogjqVByqFeAKDB0MUAQEBAQEBAQEBAQESA?= =?us-ascii?q?QEBCA0JCh0vgjMEAwMdghcBBSNLChELGAICBQQSCwICCQMCAQIBMxITBgIBAQ6?= =?us-ascii?q?JSwMVBQmvLIImhz4Dg3QBCgEBASSBC4VBhG+EQl6COoJfBYc4DJRMa4EXhHKNf?= =?us-ascii?q?Y5CkyU2gSE1I0+EXIFudIhZgTsBAQE?= X-IronPort-AV: E=Sophos;i="5.35,196,1484002800"; d="scan'208";a="261700788" Received: from nef2.ens.fr ([129.199.96.40]) by mail2-smtp-roc.national.inria.fr with ESMTP; 22 Feb 2017 21:10:52 +0100 Received: from clipper.ens.fr (clipper-gw.ens.fr [129.199.1.22]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id v1MKApbS092141 for ; Wed, 22 Feb 2017 21:10:52 +0100 (CET) Received: from smtps.spi.ens.fr ([10.129.0.3]) by clipper.ens.fr (8.14.4/jb-1.1) id v1MKApLU101764 for ; Wed, 22 Feb 2017 21:10:51 +0100 Received: from [192.168.0.3] using smtps by smtps.spi.ens.fr (8.14.3/jb-1.1) id v1MKAqWL003450 for ; Wed, 22 Feb 2017 21:10:52 +0100 (authenticated user fromherz) X-ENS-Received: ([176.159.6.225]) X-Envelope-To: To: caml-list@inria.fr References: <20170222170101.GE28111@annexia.org> <20170222173814.GG28111@annexia.org> <2432820.aHjfWRbG44@molnar> <58ADE4A2.9060105@ens.fr> <58ADEDA0.8070704@ens.fr> From: Aymeric Fromherz Message-ID: <58ADF1D3.6030005@ens.fr> Date: Wed, 22 Feb 2017 21:17:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-milter (http://amavis.org/) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Wed, 22 Feb 2017 21:10:52 +0100 (CET) Subject: Re: [Caml-list] Warning for unused variables I didn't know -warn-help. That's very complete. Indeed, I would have considered that this case was suspicious, but I perfectly understand your point. Thanks a lot! On 22/02/2017 21:01, Gabriel Scherer wrote: > Good point, I had not noticed the different in warning number. > > `ocamlc -warn-help` says: > > 26 Suspicious unused variable: unused variable that is bound > with "let" or "as", and doesn't start with an underscore ("_") > character. > 27 Innocuous unused variable: unused variable that is not bound with > "let" nor "as", and doesn't start with an underscore ("_") > character. > > I agree that the distinction is somewhat arbitrary here: arguably > variables bound in a pattern by a *let* (instead of a > pattern-matching) could be considered "suspicous" as well. But we > don't want to change the semantics of an existing pattern too much, as > it tends to annoy people, so maybe it's best left as it is. > > On Wed, Feb 22, 2017 at 2:59 PM, Aymeric Fromherz > wrote: >> Hi, >> >> Trying with OCaml 4.04 on another machine, I have the same behaviour. >> When running the ocaml interpreter with all warnings activated (-w A >> option), a warning is raised in the first case, but it is a warning 27 >> instead of a warning 26. >> >> What is the difference between these two warnings? Could it be that you >> have all warnings activated by default? >> >> Thanks, >> Aymeric >> >> On 22/02/2017 20:43, Gabriel Scherer wrote: >>> This would be a bug, but I cannot reproduce it on my machine, where >>> all OCaml versions I have (including 4.02.3) raise a warning as >>> expected. >>> >>> On Wed, Feb 22, 2017 at 2:21 PM, Aymeric Fromherz >>> wrote: >>>> Hi, >>>> >>>> Using OCaml 4.02.3, I do not have a warning for unused variables when >>>> only one of the variables in a pair is unused. >>>> For instance, the code >>>> >>>> let (a,b) = (0, 42) in b;; >>>> >>>> raises no warning, while >>>> >>>> let (a,b) = (0,42) in 1;; raises the following >>>> >>>> Warning 26: unused variable b. >>>> Warning 26: unused variable a. >>>> >>>> I would have expected a warning in the first case since a is unused. >>>> >>>> Warnings for single unused variables, such as let a = 42 in 1 are still >>>> raised. >>>> >>>> What is the reason for this? Is this behaviour intended? How are unused >>>> variables determined? >>>> >>>> Thanks in advance, >>>> Aymeric Fromherz >>>> >>>> -- >>>> Caml-list mailing list. Subscription management and archives: >>>> https://sympa.inria.fr/sympa/arc/caml-list >>>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >>>> Bug reports: http://caml.inria.fr/bin/caml-bugs >>> >> >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa.inria.fr/sympa/arc/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs >