From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q06FMmx4012169 for ; Fri, 6 Jan 2012 16:22:48 +0100 X-IronPort-AV: E=Sophos;i="4.71,468,1320620400"; d="scan'208";a="138160368" Received: from macadam.inria.fr (HELO [192.168.1.2]) ([128.93.8.130]) by mail1-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA; 06 Jan 2012 16:22:43 +0100 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) From: Damien Doligez In-Reply-To: Date: Fri, 6 Jan 2012 16:22:42 +0100 Content-Transfer-Encoding: 7bit Message-Id: <8F3B10C5-01DC-49D4-A233-40413D73C55A@inria.fr> References: <20120105200442.GA17669@annexia.org> To: caml-list X-Mailer: Apple Mail (2.1084) Subject: Re: [Caml-list] Examples where let rec is undesirable On 2012-01-05, at 21:46, Gabriel Scherer wrote: > My argument is the following: when you make a *local* edition to a > piece of code, shadowing allow you to pick variable name without > having to know about what's already bound in context. I agree with Gabriel. Consider the following expression: (let x = 21 in x + x) Assuming I haven't been so crazy as to redefine (+), is this a valid expression whose value is 42? First possible answer: yes Second possible answer: it depends on the context. I'd rather go with the first choice, and that means allowing shadowing. Consider a camlp4 extension that produces such expressions. Does it have to look at the context (including the "open" statements, functor applications, first-class modules, etc.) before it can insert this expression into your code? -- Damien