Name spaces in Spoon

goran at goran at
Fri May 26 10:36:31 UTC 2006

Hi Ralph!

"Ralph Johnson" <johnson at> wrote:
> SystemDictionary needs  to be nested.  Each module should have its own

I don't agree. :) If you look at 3.3alpha with modules (by late Henrik
Gedenryd mainly, which was abandoned) it has an elaborate nested
architecture based on the same idea which Dan actually started with the
environment instvar etc.

IMHO one of the reasons that the 3.3 modules adventure ended with
abandonment was the complexity of imports/exports in a nested hierarchy.

I advocate having a "flat" model with simply named buckets of names, as
in my Namespace solution (see below).

> "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.

Yes, all nice in theory. I am however weary of the effects in practice.
It is quite a step away from the current very simple and immediate
system, just like the Modules-3.3 was, and look where that ended.

I simply think that baby steps are needed here. Revolution is fine, but
risky. An example of "evolution" proving itself is Monticello. By using
just a few simple tricks it manages to work perfectly inside the
existing Squeak environment. And that is IMHO the reason for its

> I recently read  (probably in squeak-dev) a proposal to standardize
> the way people use prefixes to ensure that class names don't collide.

That was my proposal which I have presented on numerous occasions. The
latest little writeup of it (with tongue in cheek) is here:

...and here is code (I have it updated for 3.9, but haven't published it

The very short description is that it adds the ability to have class
names with the prefix separated using "::". The system will then
consider the prefix a Namespace and it will even create instances of the
Namespace class etc. But in the end all classes still hang in Smalltalk
and all old code works fine. The neat thing is that just like with
Monticello all old tools work just fine.

I restricted it to one level though, so there is no hierarchy.

> 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.

Yes, the patch to get a Squeak image to accept code using such global
names is very, very small. This means that old images without this
support can very easily be patched, IIRC it was 3 methods touched in
Scanner and Parser or something like that.

>  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.

As my code actually shows. Just try it. And yes, I should post my 3.9

> -Ralph Johnson

regards, Göran

More information about the Squeak-dev mailing list