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.6 required=5.0 tests=AWL,NO_REAL_NAME autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 77D43BC69 for ; Wed, 28 Mar 2007 17:37:03 +0200 (CEST) Received: from server2.thinkcrime.de (server2.thinkcrime.de [213.133.110.149]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2SFb3FF009484 for ; Wed, 28 Mar 2007 17:37:03 +0200 Received: from hod-sarge-2005-10.lan.m-e-leypold.de (dslb-088-072-223-150.pools.arcor-ip.net [88.72.223.150]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server2.thinkcrime.de (Postfix) with ESMTP id 52E0A488176 for ; Wed, 28 Mar 2007 17:37:04 +0200 (CEST) Received: by hod-sarge-2005-10.lan.m-e-leypold.de (Postfix, from userid 1003) id BD147376F9; Wed, 28 Mar 2007 17:43:51 +0200 (CEST) To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] How must we teach lexical scope? References: <6f9f8f4a0703280059m5b9af3a1t3a9541b772af98bb@mail.gmail.com> <20070328084955.GA21199@yquem.inria.fr> <6f9f8f4a0703280734p49ed0b7fk48787a8ba3a76e9e@mail.gmail.com> Organization: Leypold, Software-Dienstleistungen und -Beratung From: ls-ocaml-developer-2006@m-e-leypold.de Date: Wed, 28 Mar 2007 17:43:51 +0200 In-Reply-To: <6f9f8f4a0703280734p49ed0b7fk48787a8ba3a76e9e@mail.gmail.com> (Loup Vaillant's message of "Wed, 28 Mar 2007 16:34:31 +0200") Message-ID: User-Agent: Some cool user agent (SCUG) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Miltered: at concorde with ID 460A8B9F.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; maranget:01 maranget:01 abstraction:01 repetitive:01 markus:01 28,:98 blog:98 blog:98 luc:01 luc:01 lexical:01 lexical:01 caml-list:01 writes:01 precisely:01 "Loup Vaillant" writes: > 2007/3/28, Luc Maranget : >> > So here are a few questions: >> > -> Is lexical scope that important when learning pure functional >> > programming? >> > -> Are environments helpful (even the slightest bit) when teaching >> > lexical scope? >> > -> Where does this idea come from? I have not read a single book, as >> > single article nor blog talking about environments. >> > -> How can we teach lexical scope? Is there a simple solution, the >> > kind of a first year student can understand in less than an hour? >> >> An attempt to answer your question 1. > > OK, It was about the implementation of first class function in a > Pascal like language. > > Personally, I think environments are about the implementation of > lexical scope, not its specifications. Therefore, teaching them in > the first year of a programming course is premature. I may be wrong, > so I am trying to verify that. Personally I think you're wrong here. Environments (as mapping from identifier to values) represent the context in which a given expression must be read and interpreted (in both senses). I cannot imagine a way to do so precisely without using a similar abstraction. With horror I remember some learn-to-program books I read in my youth and which tried to talk about scope by talking about wether a identifier is "valid" or something like this: horrible. Talking about free variables and environments on the other side makes it very easy to see which parts of an expression must get "meaning" by being interpreted in some context (environment). I find that rather useful. Grasping the idea of a free variable (perhaps in an informal way) and applying the ideas of environment(s) should take a reasonably bright student hardly more than an hour (but I might be wrong). Concerning your > I don't understand the way were are taught lexical scope. Our > professors used "environments", where free variable would suffice. > (An environment is the set of defined values at a given time. The > environment of a value is the environment of when this value is > defined.) -- I'd say that environment and free variables are "dual" or complementary concepts. One is not useful without the other. >>From what you write, I'm not sure, the course (at Tolouse 3) you've been talking about is just badly structured, wether the problem is at yours or your brothers side or wether (I suggest to consider that) not all students are as bright as you or your brother and therefore things can get a bit repetitive. On the other side > -> Where does this idea come from? I have not read a single book, as > single article nor blog talking about environments. I wonder that you have not heard about environments before. Perhaps it's not your part yet to improve teaching in that area :-). Nonetheless: If you have a suggestion how to talk about lexical scope or the "meaning" of an expression without resorting to environments, I'd be interested to hear more about it. Regards -- Markus