Name spaces in Spoon

Ralph Johnson johnson at
Thu May 25 15:20:41 UTC 2006

I'm just getting into Spoon (hmm, I'm just learning to use Spoon, I'm
getting stirred up with Spoon, ... there ought to be a good line here)
so I'm probably making some mistakes, but mailiing lists are good for
finding that out.

My guess is that Spoon doesn't implement the global variable
Smalltalk.  I'm going to assume that people know that the global
variable Smalltalk is implemented as a dictionary (a SystemDictionary,
actually) and that global variables are implemented as Associations.

SystemDictionary needs  to be nested.  Each module should have its own
"global variable Smalltalk", i.e. its own SystemDictionary that holds
the names of all classes.  The compiler looks up a name by looking in
a dictionary, but a SystemDictionary will look in its parent if it
doesn't have its own copy. This way, two modules can each have a class
with the same name and the two classes won't collide.

I recently read  (probably in squeak-dev) a proposal to standardize
the way people use prefixes to ensure that class names don't collide.
It was something like Prefix::ClassName and the point was that only
one or two places in the image had to change to legalize that kind of
name.  If "Prefix" was the module name, and if we ensured that module
names were unique, and if importing a module caused all the classes in
the module's local version of Smalltalk to be added to the root
version of Smalltalk with this prefix added, then very little would
have to change in the programming environment.

-Ralph Johnson

More information about the Squeak-dev mailing list