multiple classes with the same name, namespaces

Ralph Johnson johnson at cs.uiuc.edu
Fri May 26 11:27:56 UTC 2006


On 5/26/06, Craig Latta <craig at netjam.org> wrote:
>         Spoon currently still has the old system dictionary, but I'd like to
> remove it. I think we should just rewrite users of "Smalltalk at:"
> (probably in some automated fashion, both in situ and during method
> transfer).

And how do you propose to do this?  The reason I posted my message was
that I couldn't see any way that Spoon could implement "Smalltalk at:"
and I thought that there should be a way.  From what you wrote below,
perhaps you want to convert "Smalltalk at: className" into "Object
allSubclasses detect: [:eachClass | eachClass name = className]".
This will be nondeterministic when you have multiple classes with the
same name.

>Instead of a system dictionary, I'd rather have some class
> take responsibility for each former non-class "global" variable, and use
> messages for access.

This is easy for non-class globals.  Make them Singletons.

The problem remains, though, what about classes?

>         The classes we can put in some cache collection that is known to the
> compiler, but it need not be keyed. Then each class has complete
> responsibility for its name, and we needn't worry about other objects
> having out-of-sync notions of any class names.

So, you want to find a class by sequential search, asking each class
for its name?

Do you want to search the subclasses of Object, or ProtoObject?  Or
would you rather have a separate object to be this cache?  If you have
a separate object, how do you add objects to it when you load a
module?

-Ralph Johnson



More information about the Squeak-dev mailing list