From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA00131 for caml-red; Fri, 3 Nov 2000 19:13:44 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA28651 for ; Fri, 3 Nov 2000 18:34:53 +0100 (MET) Received: from mauny-pc.cs.nyu.edu (MAUNY-PC.CS.NYU.EDU [128.122.81.137]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id eA3HYqj10514; Fri, 3 Nov 2000 18:34:52 +0100 (MET) Received: (from mauny@localhost) by mauny-pc.cs.nyu.edu (8.10.1/8.10.1) id eA3HaoR13695; Fri, 3 Nov 2000 12:36:50 -0500 Date: Fri, 3 Nov 2000 12:36:50 -0500 From: Michel Mauny To: Pierre Weis Cc: "Michael Sperber [Mr. Preprocessor]" , caml-list@inria.fr Subject: Re: Redefinition doesn't work Message-ID: <20001103123650.A13661@mauny-pc.cs.nyu.edu> Reply-To: mauny@cs.nyu.edu References: <200011031656.RAA30196@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5i In-Reply-To: <200011031656.RAA30196@pauillac.inria.fr>; from Pierre.Weis@inria.fr on Fri, Nov 03, 2000 at 05:56:14PM +0100 Sender: weis@pauillac.inria.fr I don't want to spray gasoline on what looks like the beginning of a flame war, but the `dynamic' behavior of Scheme variables shouldn't be confused with dynamic scoping. Pierre Weis wrote/écrivait (Nov 03 2000, 05:56PM +0100): > Scheme has lexical scoping locally. It has dynamic binding > globally, > I find in the R5RS, a clear distinction between top level > definitions that are said to be equivalent to assigments That's because undefined identifiers are considered to be bound to global locations. Therefore, a global definition is considered as an assignment to such a location. This is where the difference comes from. To be sure that Scheme uses lexical binding for both global and local identifiers, consider this simple example: ; ----------- (define (f x) (+ (g x) 1)) (f 1) ; => Error: g is undefined (let ((g (lambda (z) z))) (f 1)) ; => Error: g is still undefined, although it's avaliable ; from the dynamic env (define (g x) x) (f 1) ; => 2 ; ----------- Under dynamic scoping, the second call (f 1) would succeed, since g is available in the dynamic context. This is how ynamic Lisp would behave. In Scheme, when f is defined, g is lexically bound to a location. That location is assigned when g gets defined (or redefined). -- Michel No, I'm not here.