Dynamic scoping

Lex Spoon lex at cc.gatech.edu
Fri Jan 31 09:54:24 UTC 2003

Anthony Hannan <ajh18 at cornell.edu> wrote:
> Hi Allen, thanks for responding, and thanks for the language design
> principles.
> Allen Wirfs-Brock <Allen_Wirfs-Brock at Instantiations.com> wrote:
> > The topic at hand is dynamic "variable" scoping.
> I prefer messages to variables because they are more powerful and
> general.  It allows more sophisticated queries, instead of just
> returning a fixed value.  I guess I'm just proposing another form of
> exception handling, where exceptions are distinguished by selector
> instead of class, that is why I reused #on:do:.

That's interetsing, but it seems to make a nuisance of the vast majority
of cases, where you are binding a plain-jane variable.

Also, I'm not sure if it's a good idea that what looks like a variable
can now have a block sitting behind it.  Variables are a fundamental
part of understanding how code works, and it would be nice if they
behaved according to the expected rules.  Computers are already full of
rules that are "mostly" true, and everyone has had debugging experiences
where 2+2 returned 5 or some other bizarre htings, because they are
using rules that are just mostly true.  It is nice if I write a variable
and immediately read from it, I know I'll get the value back (barring
multithreading, which granted is a "mostly" rule itself!).

The blocks approach may make more sense in Self, where people are used
to the ambiguity of variables and methods.

In short, I love the implementation idea of tracing the stack to find
your context, but I don't like the user-level invocation, either.


More information about the Squeak-dev mailing list