Squeak and Namespaces

goran at krampe.se goran at krampe.se
Wed Nov 29 22:13:51 UTC 2006


Hi!

"J J" <azreal1977 at hotmail.com> wrote:
> Well I haven't looked at the implimentation details, no.  But what will be 
> the result is pretty obvious:  Right now you have a global namespace for all 
> classes in your image.  After the change you will have the same but instead 
> of MCDictionary or something it will be Monticello::Dictionary.  In other 
> words, the end result is just that the identifiers get longer and part of it 
> is implicit (i.e. you don't have to type it out usually).

Yes, more or less.
 
> The problem comes if we determine there is a much better way to do this.  We 
> can't just pull the namespaces out because then you will have 30 classes 
> named "Dictionary" and so on.  You will have to either touch them all or run 
> some script that appends the namespace on the front of the class and then 
> pull namespaces out.  I don't see either of these as doable, so I would 
> expect that once namespaces are in as default for a couple of years that is 
> what we are going to have from now on.

Eh, no not really. Today without my solution MCDictionary has the name
#MCDictionary.
With my solution it can still be called that, or be renamed to
#Monticello::Dictionary. Yes, the name of the class is the full name,
not the short one.

If we then in a while decide my solution sucks... eh, I guess the only
valid reason I can come up with would be that people think that
'Monticello::Dictionary' actually looks bad compared to 'MCDictionary',
then sure, revert those 3 methods it is all about and remove the  '::'
so that it is now called 'MonticelloDictionary' - or hey, just replace
'Monticello::' with 'MC' and tada - we are back where we are now.

Renaming classes is not hard, we do it all the time. And if we ever want
to move away from prefixes to anything else - whatever solution you
think that we *ever* will be able to agree on ;) - then we would need to
do the same anyway.

> p.s. Does it get the namespace from the category?  If not, then that might 
> be something to think about. :)

The class creation template borrows the category name in some fashion
IIRC. But it is only a suggestion.

regards, Göran



More information about the Squeak-dev mailing list