[GOODIE] Namespaces-gk

Avi Bryant avi at beta4.com
Thu Apr 15 18:57:28 UTC 2004


On Apr 15, 2004, at 6:13 AM, goran.krampe at bluefish.se wrote:

> IMHO it is pretty damn hard to make it any simpler than this.

So, looking through the code, one thing that strikes me as overly 
complicated is all the various modifications around renaming.  Why are 
they necessary?  I guess so that you can update the 'environment' 
instance variable, but then, it's unnecessary too - why can't the 
namespace of a class be a dynamic lookup?

Class>>namespace
   ^ Namespace namedOrCreateForName: self name

I bet this would simplify a lot of code.

It also seems odd to me that Namespace is still a subclass of 
IdentityDictionary, but doesn't have any keys.  I think it should 
*look* like a Dictionary (it would be nice if #keys and #do: worked, 
for example), but it probably shouldn't actually be one.  I assume this 
is left over from your previous implementation strategy.

After the various discussions about namespace granularity, I also 
wonder at the choice to encourage the user (through the class creation 
templates) to have one namespace per top-level category.  I'm not sure 
exactly what we'll want in the long run, but this is probably too 
fine-grained a default.

Very neat to see this all working, though.

Avi




More information about the Squeak-dev mailing list