Name Spaces - RFC

Giovanni Giorgi giovanni.giorgi at mlab.disco.unimi.it
Thu Jun 10 14:49:53 UTC 1999


Excuse me,
    I am a student at University of Milan, Italy.
I have worked with Visual Works 3.0 for about two years, for my personal
works, then I try Squeak, and I' d like it very much. It is network.
sound & image oriented (more then VW I think).
Now I' d like to create a small Name Space utility for the Squeak
Smalltalk.
I' d like to know it is a good idea and if there isn't another tool for
doing the same thing :)

                                The idea.
The growing applications near Squeak, and the presence of two GUI, seems
require a more strong support to the naming of class under this free
Smalltalk.
The Visual Works 5.0 has just implemented a Name Space facility (I do
not know of what type, but it seems a good idea).
So, I think it will be a nice feature having a such thng, similar to the
Java package name space.


The idea is to manage Smalltalk and Undeclared dictionary for obtaining
such feature, without requiring the modification of the SqueakVM. The
overhead involved should be kept low.


                           A Proposed Protocol
The "true" class name is obtained by prepending the name-space
identifer.
So for example, I reate the two class MorphButton and MVCButton then  I
use

(NameSpaceManager createNew: #Morph) addClass: MorphButton.
(NameSpaceManager createNew:#MVC) addClass: MVCButton.

for having the Two Class sharing the same name "Button".

For using the Button name without problem, in my sweet code I put
something like:

NameSpaceManager enter: #MVC doing:[
    Button new. "It is really a MVCButton instance"
]

NameSpaceManager enter: #Morph doing:[
    Button new. "Is really a MorphButton instance"
]

Nesting name space can be  allowed but conflict semantic how it is
managed?!
The key idea is that the inner enter:doing: message will mask the outer
scope class name space.
So in

NameSpaceManager enter: #MVC doing:[
   NameSpaceManager enter: #Morph doing:[
        Button new. "Is really a MorphButton instance again!!"
    ]
]


For saving/loading my name spaces:
NameSpaceManager save:#MVC inStream: aWriteStream.
NameSpaceManager loadFromStream: aReadStream.

Other stuff:

NameSpaceManger checkConflictOfThese:
aOrderedCollectionOfNameSpaceSymbols
NameSpaceManager get: #MVC  "<-returns a OrderedCollection of the
classes contained in the NameSpace. Modifiying the collection  does
nothing.(?)"

NameSpaceManager enter: #Smalltalk doing: [
   " I am out from all NameSpace in the nice Smalltalk space!!"
]

What do you think about it? It is a good protocol and idea?
Or is it  a time wast?

Thank you very much!!
--
// Giovanni Giorgi           e-mail:
giovanni.giorgi at mlab.disco.unimi.it
// Master Thesis  at http://mars.sal.disco.unimi.it/~giorgi
// Student & (ex)Tutor at Depart. of Computer Science of Milan, Italy.





More information about the Squeak-dev mailing list