🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.logo
Article #69

Re: Dynamic scope (was Re: Future of Logo)

#69
From: Richard Rogers
Date: Thu, 06 Aug 1992 01:35
40 lines
2167 bytes
In article <1992Aug5.204731.22492@jarvis.csri.toronto.edu> flaps@dgp.toronto.edu (Alan J Rosenthal) writes:
>bh@anarres.CS.Berkeley.EDU (Brian Harvey) writes:
>>in Logo, lexical scope would just be a restriction.  (That is, the variables
>>available to a given procedure under lexical scope would be a subset of the
>>variables available to it with dynamic scope.)
>
>I don't think that this is quite correct... if a name is the name both of
>a global variable and of a local variable in an enclosing procedure frame,
>then with dynamic scope you get the variable in the enclosing procedure
>frame, but with lexical scope you get the global variable.  Neither of
>these sets is a subset of the other.

If I understand your comment, I think it's incorrect.  If this is the situation
you are talking about:

global variable A

procedure X
   local variable A

   local procedure Y
         access A
   end Y

end X

Now the question is, does the A in Y refer to X's A or to the global A?  Under
static scoping, the A in Y always refers to X's A, not the global as you 
indicate.

Under dynamic scoping, the A in Y refers to the A in whatever called Y.  So 
Brian seems to be correct.  Under static scoping, only X could call Y.  With
dynamic scoping, X could call Y, but so could other things, meaning A can refer
to other things.

The question of whether or not this restriction exists is different from the
question of whether or not it is desirable :-)

This is one of the reasons I dislike dynamic scoping...  How can I debug it if
I don't know what it is?
Technical Details
Message-ID: <1992Aug6.013515.1220@beaver.cs.washington.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zephyr.ens.tek.com!uw-beaver!rrogers
References: <1992Aug5.100121.28641@beaver.cs.washington.edu> <15omhaINNgvr@agate.berkeley.edu> <1992Aug5.204731.22492@jarvis.csri.toronto.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zephyr.ens.tek.com!uw-beaver!rrogers
From: rrogers@cs.washington.edu (Richard Rogers)
Newsgroups: comp.lang.logo
Subject: Re: Dynamic scope (was Re: Future of Logo)
Message-ID: <1992Aug6.013515.1220@beaver.cs.washington.edu>
Date: 6 Aug 92 01:35:15 GMT
References: <1992Aug5.100121.28641@beaver.cs.washington.edu> <15omhaINNgvr@agate.berkeley.edu> <1992Aug5.204731.22492@jarvis.csri.toronto.edu>
Sender: news@beaver.cs.washington.edu (USENET News System)
Organization: Computer Science & Engineering, U. of Washington, Seattle
Lines: 40