Browse thread
Objective Caml 3.09 released
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Damien Doligez <damien.doligez@i...> |
| Subject: | Re: [Caml-list] Objective Caml 3.09 released |
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