From: Damien Doligez <damien.doligez@inria.fr>
To: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Objective Caml 3.09 released
Date: Fri, 28 Oct 2005 21:14:25 +0200 [thread overview]
Message-ID: <3ADF9856-A290-4EE1-B228-1AC406A85979@inria.fr> (raw)
In-Reply-To: <4361A431.9010508@cs.caltech.edu>
On Oct 28, 2005, at 06:08, Aleksey Nogin wrote:
> AFAIU, there are two warnings - "Y" for variables bound with let
> and "Z" for variables bound by pattern matching. By default, Y is
> enabled and Z is not.
The rules for Y are a bit complex. They are designed to match our style
of programming, where we sometimes document patterns by giving names to
all the arguments, even if they are unused.
Y will warn you on all variables bound with an "as" (in a let-in or a
match). For the other variables of a let-in pattern, it will warn you
only if all of them are unused. Examples:
let (x, y) = (0, 0) in 0;; (* warning on x and y *)
let (x, y) = (0, 0) in x;; (* no warning *)
let (x, y) as z = (0, 0) in (x, y);; (* warning on z *)
match 1 with _ as z -> 1;; (* warning on z *)
Variables whose names start with _ are always ignored for the
purposes of
these warnings (both Y and Z):
let (_x, y) = (0, 0) in 0;; (* warning on y *)
let (_x, y) = (0, 0) in _x;; (* warning on y *)
Z will warn you on all unused variables bound by "let-in" or "match",
except the ones that are (or would be) reported by Y. Note that it
doesn't
make much sense to have Y disabled and Z enabled.
Pattern-matchings introduced by the "fun" and "function" keywords behave
like the ones that start with "match".
> Use "ocamlc -wA" to enable all the warnings.
That should be "ocamlc -w A" with a space.
-- Damien
next prev parent reply other threads:[~2005-10-28 19:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-27 14:24 Xavier Leroy
2005-10-27 14:36 ` [Caml-list] " Damien Doligez
2005-10-27 15:40 ` skaller
2005-10-28 2:44 ` Eijiro Sumii
2005-10-28 4:08 ` Aleksey Nogin
2005-10-28 6:49 ` Eijiro Sumii
2005-10-28 19:14 ` Damien Doligez [this message]
2005-10-28 21:12 ` Jon Harrop
2005-10-29 14:31 ` Stefan Monnier
2005-10-28 7:28 ` [Caml-list] " Aleksey Nogin
2005-10-29 5:18 ` Vincenzo Ciancia
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=3ADF9856-A290-4EE1-B228-1AC406A85979@inria.fr \
--to=damien.doligez@inria.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