From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Aymeric Fromherz <aymeric.fromherz@ens.fr>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Warning for unused variables
Date: Wed, 22 Feb 2017 15:01:07 -0500 [thread overview]
Message-ID: <CAPFanBH-cRxJCBB12GW917QThi+7ijxLVEubQPmMpOERqCM8gg@mail.gmail.com> (raw)
In-Reply-To: <58ADEDA0.8070704@ens.fr>
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
<aymeric.fromherz@ens.fr> 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
>> <aymeric.fromherz@ens.fr> 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
next prev parent reply other threads:[~2017-02-22 20:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-22 17:01 [Caml-list] List of structurally typed objects Richard W.M. Jones
2017-02-22 17:09 ` Gabriel Scherer
2017-02-22 17:36 ` Richard W.M. Jones
2017-02-22 17:43 ` Nicolás Ojeda Bär
2017-02-22 17:53 ` Richard W.M. Jones
2017-02-22 17:28 ` Damien Guichard
2017-02-22 17:38 ` Richard W.M. Jones
2017-02-22 18:08 ` Ivan Gotovchits
2017-02-22 19:04 ` Mikhail Mandrykin
2017-02-22 19:21 ` [Caml-list] Warning for unused variables Aymeric Fromherz
2017-02-22 19:43 ` Gabriel Scherer
2017-02-22 19:59 ` Aymeric Fromherz
2017-02-22 20:01 ` Gabriel Scherer [this message]
2017-02-22 20:17 ` Aymeric Fromherz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPFanBH-cRxJCBB12GW917QThi+7ijxLVEubQPmMpOERqCM8gg@mail.gmail.com \
--to=gabriel.scherer@gmail.com \
--cc=aymeric.fromherz@ens.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox