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=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 88766BC69 for ; Thu, 29 Mar 2007 10:17:29 +0200 (CEST) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.241]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2T8HShs004339 for ; Thu, 29 Mar 2007 10:17:29 +0200 Received: by an-out-0708.google.com with SMTP id c24so107373ana for ; Thu, 29 Mar 2007 01:17:28 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=esBZ50ZyeI771Gq/6NfVWsOAYkotDl95BiqjGjUevw9g3h/5NIFGAomF4wN0UTtBbgG2rAIBmcI9u4/IRzGDz+rgUTl9Nywo5fcyZtqIWMys8FgPsDgzS9S7Kyd/NJT1kzUxjZukdqtvCMpQIEwvbh6dyHqyji3chVLK0psE6Dw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=sRiVKBAjarXzzJg5wia3dl8Gc40H/29J0pHnxohoLsefbXryBmVe/lOl3+Scf3nJOr/y3QfqbOl9ad3uHt3UGT5JbQqIzamt+SPnrFcLm+WAPcGLPx6oo/QZj/jx+M7CfP5NMhrTKEegll5ogUM/4Jg2Ju1jkOhNlKLrKZ0eUQs= Received: by 10.100.112.19 with SMTP id k19mr185507anc.1175156248194; Thu, 29 Mar 2007 01:17:28 -0700 (PDT) Received: by 10.100.111.13 with HTTP; Thu, 29 Mar 2007 01:17:28 -0700 (PDT) Message-ID: <6f9f8f4a0703290117qf0fa062n6430a168e7acf5b7@mail.gmail.com> Date: Thu, 29 Mar 2007 10:17:28 +0200 From: "Loup Vaillant" To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] How must we teach lexical scope? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <6f9f8f4a0703280059m5b9af3a1t3a9541b772af98bb@mail.gmail.com> <20070328084955.GA21199@yquem.inria.fr> <6f9f8f4a0703280734p49ed0b7fk48787a8ba3a76e9e@mail.gmail.com> <6f9f8f4a0703281009i74927505hba3e04227f61e357@mail.gmail.com> X-j-chkmail-Score: MSGID : 460B7618.001 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 460B7618.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 28,:98 lexical:01 syntactic:01 caml-list:01 substitution:02 substitution:02 data:02 variables:02 parameters:02 scope:03 describing:03 perhaps:04 problem:05 useless:05 anyway:06 2007/3/28, ls-ocaml-developer-2006@m-e-leypold.de : > But perhaps I understand your problem better now: The difference > you're wanting to make is the substitution of symbols by values at > definition time vs. at evaluation time (I hope it is clear what I want > to say). Exactly. > But you'll have to explain substitution at evaluation time > anyway (when a function is called and the formal parameters are > bound). I don't understand what your attempt to avoid to talk about an > environment (from which a comes in the example above) will buy you. Substitution at definition time is how I naturally thought of it. That is, the definition: # f x = a + x;; was automatically replaced by: # f x = 3 + x;; in my head, so there were no more need for any environment. However, I must admit such a way of thinking has its limits: as long as the substitution is simple, that is easy. When a free variable is some complicated piece of data (or even code), one (I) must switch to an environment representation. In that case, the environment I think about is only the set of free variables actually used by the function. The environments our professors talked about included all values, including the useless ones. I thought it was unnecessary, but I see the trade-of, now: their process is quite long (not to mention the syntactic burden of describing each environment) but it is systematic, and simple. Because it is, it looks silly. I don't like environments, but you convinced me I haven't came up with a better solution. Regards, Loup