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 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id C1B80BC6E for ; Wed, 28 Mar 2007 10:00:02 +0200 (CEST) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.248]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2S8019q031505 for ; Wed, 28 Mar 2007 10:00:02 +0200 Received: by an-out-0708.google.com with SMTP id c24so2613432ana for ; Wed, 28 Mar 2007 00:59:59 -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:mime-version:content-type:content-transfer-encoding:content-disposition; b=jEm0pT09rPRVcTjpXRW3hozEYRTcDiqmGQv8yopSg/gE29Vli9+s//qDP525dsNbzX79ltiB5/3s6iAwb/e2yn5KNe4/+sQLjdo4gqHOImFpehtvBweiNu2s6SK7PCMFeFh2uGwgayvgGVWlQB2qvwkixEUXO66mwfaVMgkT87I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=P5rsxB/KhgGlOhG+3I4onOy9BAoPHgd4LNCM+EWK0QFjr9mEbEtW0azKfnG7ESVs3n90490avbIbNf7Va+i+LRayHRJtO+ChaVxDn4o1uI/vpwGZnsh+Kp2a2lu91KHoA0Vvik32j06tTI9tRbdR84lv0MiUZ2LyEPdtFX0rJmk= Received: by 10.100.124.5 with SMTP id w5mr67974anc.1175068799510; Wed, 28 Mar 2007 00:59:59 -0700 (PDT) Received: by 10.100.111.13 with HTTP; Wed, 28 Mar 2007 00:59:59 -0700 (PDT) Message-ID: <6f9f8f4a0703280059m5b9af3a1t3a9541b772af98bb@mail.gmail.com> Date: Wed, 28 Mar 2007 09:59:59 +0200 From: "Loup Vaillant" To: caml-list@yquem.inria.fr Subject: How must we teach lexical scope? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-j-chkmail-Score: MSGID : 460A2081.003 on concorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at concorde with ID 460A2081.003 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; syntax:01 blog:98 lexical:01 lexical:01 closures:01 defined:02 defined:02 caml:02 functional:02 functional:02 scope:03 scope:03 programming:03 suffice:03 variable:06 My brother is currently learning Camllight at the Toulouse 3 university, France. Five years ago, I followed the same course. 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.) -> They talk about closures, even in the case of pure functional style, even in the absence of free variable (except the built in constructions, such as '+'). -> They take hours and hours of boring an silly looking exercises about environment, so we can understand how important environments are.(we even had to learn a specific syntax to talk about them). -> The promised power of the language is completely overlooked. Even the crippled Pascal on my calculator looked more powerful. Luckily, I had later a professor, who showed us the real power of Caml. He didn't talked about environments. 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? Thanks, Loup