From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 1993DBB84 for ; Wed, 13 Aug 2008 14:18:10 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AioBANltokjC2fJbomdsb2JhbACJMYhFAQEBAQEBBwUGCRGkd4FV X-IronPort-AV: E=Sophos;i="4.32,201,1217800800"; d="scan'208";a="16084481" Received: from anchor-post-33.mail.demon.net ([194.217.242.91]) by mail1-smtp-roc.national.inria.fr with ESMTP; 13 Aug 2008 14:18:09 +0200 Received: from orion.metastack.com ([80.177.38.218]) by anchor-post-33.mail.demon.net with esmtp (Exim 4.67) id 1KTFIn-000IbB-A6 for caml-list@yquem.inria.fr; Wed, 13 Aug 2008 12:18:09 +0000 Received: from orion.metastack.com (IDENT:25@localhost [127.0.0.1]) by orion.metastack.com (8.13.4/8.13.3) with ESMTP id m7DB9OPV013393 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 13 Aug 2008 12:10:24 +0100 Received: (from defang@localhost) by orion.metastack.com (8.13.4/8.13.3/Submit) id m7DAjnBY013313 for ; Wed, 13 Aug 2008 11:45:49 +0100 X-Authentication-Warning: orion.metastack.com: defang set sender to using -f Received: from countertenor (cpc1-cmbg10-0-0-cust76.cmbg.cable.ntl.com [81.102.132.77]) by orion.metastack.com (envelope-sender ) (MIMEDefang) with ESMTP id m7DAjjrD013309; Wed, 13 Aug 2008 11:45:49 +0100 (BST) From: "David Allsopp" To: "'Richard Jones'" Cc: "'OCaml List'" References: <9E2C98C8798A487DAE77F20A9DC4F1E8@countertenor> <20080813101243.GA2038@annexia.org> Subject: RE: [Caml-list] Value shadowing Date: Wed, 13 Aug 2008 12:04:21 +0100 Organization: MetaStack Solutions Ltd. Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: Acj9KoTjz2K+ZrzDTQKlmh2PJlj4/QABwT0w X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 In-Reply-To: <20080813101243.GA2038@annexia.org> X-Scanned-By: MIMEDefang 2.63 on 80.177.38.218 X-Spam: no; 0.00; 0100,:01 foo:01 ocaml:01 compiler:01 clairvoyant:98 wrote:01 wrote:01 caml-list:01 tail:01 tail:01 match:02 match:02 variables:02 variables:02 suggestion:03 > On Wed, Aug 13, 2008 at 09:54:36AM +0100, David Allsopp wrote: > > Suppose I have this piece of code: > > > > let foo xs = > > match xs with > > x::xs -> if x > > then xs (* Return the tail of the list *) > > else xs (* Return the entire list *) > > | [] -> raise Exit > > I'd find it very counter-intuitive if OCaml behaved like this, and > annoying if it gave a warning. Just name the variables to be > different! You seem to have missed my point that I wrote the above *in error* so "Just name the variables to be different!" is a clairvoyant response in this case... I'm aware that that's what has to change :o) That said, I do see your point that my proposed warning would mean that you could never match a list tail with the same name as the whole list - a definite weakness of my suggestion that I hadn't spotted before. Personally, I'd be happy to live with always using two names in this context - but perhaps this should therefore be the job of a home-grown postprocessor on .annot files, rather than a compiler feature request? David