SmalltalkImage current
subbukk
subbukk at gmail.com
Tue Jul 3 18:25:13 UTC 2007
On Tuesday 03 July 2007 7:53 pm, Gary Chambers wrote:
> Seems like the idea of "Global Variables" has got a bad name from misuse in
> other languages. Remember, Smalltalk is an Environment. Globals are
> good/necessary when appropriate!
It has to do with scope. A global variable can be modified by any method in
the entire image, so it is very vulnerable to unintended modifications. Safe
designs use as minimal a scope as possible for variables.
In Squeak, classes are global in scope. With over 2000 of them in newer
images, Squeak is as vulnerable as other language environments :-(. Lack of
modular scoping mechanisms leads to "Batman" syndrome where programmers use
prefixes to mark out scopes - Only BatMan can drive a BatMobile or fly a
BatJet fitted with BatWings.
Regards .. Subbu
More information about the Squeak-dev
mailing list
|