From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id DC2D4BB9A for ; Fri, 28 Oct 2005 21:14:30 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j9SJEUnH021515 for ; Fri, 28 Oct 2005 21:14:30 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA24748 for ; Fri, 28 Oct 2005 21:14:30 +0200 (MET DST) Received: from [127.0.0.1] (yquem.inria.fr [128.93.8.37]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j9SJESXd021510 for ; Fri, 28 Oct 2005 21:14:29 +0200 Mime-Version: 1.0 (Apple Message framework v734) In-Reply-To: <4361A431.9010508@cs.caltech.edu> References: <4360E32F.1060905@inria.fr> <4361A431.9010508@cs.caltech.edu> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <3ADF9856-A290-4EE1-B228-1AC406A85979@inria.fr> Content-Transfer-Encoding: 7bit From: Damien Doligez Subject: Re: [Caml-list] Objective Caml 3.09 released Date: Fri, 28 Oct 2005 21:14:25 +0200 To: Caml List X-Mailer: Apple Mail (2.734) X-Miltered: at concorde with ID 43627896.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 43627894.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; damien:01 damien:01 caml-list:01 ocamlc:01 ocamlc:01 2005,:98 wrote:01 doligez:01 doligez:01 patterns:02 caml:02 match:02 match:02 objective:02 variables:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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