[gambit-list] Lexical scope

Benjohn Barnes benjohn at fysh.org
Mon Sep 5 15:27:15 EDT 2011


On 5 Sep 2011, at 15:51, Raffael Cavallaro wrote:

> 
> On Sep 5, 2011, at 10:02 AM, Steve Graham wrote:
> 
>> Can someone help?
> 
> Marc's reply is, of course, succinct and correct.
> 
> If you want a fuller understanding of scope, I've found the wikipedia article to be relatively clear and to the point:
> <http://en.wikipedia.org/wiki/Scope_(computer_science)>
> 
> It covers both lexical (a.k.a. "static") scope, and dynamic scope, and gives examples.

If you've got a C language kind of background, to a reasonable approximation, dynamic scoping is a lot like a global variable: anyone who reads or writes a given binding sees the same one. It caries similar risks to a global variable, but there are also some handy things you can do with them such as set up exception handlers. Static / lexical scoping is like the normal local variables in a function.

Hope that helps (and that if it's nonsense someone will correct me).

Cheers,
	B

-- 
benjohn at fysh.org - Twitter @benjohnbarnes - Skype benjohnbarnes - Mobile +44 (0) 7968 851 636






More information about the Gambit-list mailing list