[GOODIE] Namespaces-gk

goran.krampe at bluefish.se goran.krampe at bluefish.se
Thu Apr 15 21:20:23 UTC 2004


Hi!

Avi Bryant <avi at beta4.com> wrote:
> On Apr 15, 2004, at 12:19 PM, stéphane ducasse wrote:
> > On 15 avr. 04, at 20:57, Avi Bryant wrote:
> >
> >> 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
> >>
> > Hi avi
> >
> > why not using environment? This is why we started to removed all the 
> > hardcoded reference to smalltalk from the kernel and as soon as 
> > 3.8alpha starts I'm planning to do a major cure of the image.
> 
> Precisely because everything that used to reference Smalltalk now sends 
> #environment, I think we should be careful about using it.  For now, 
> the #environment of any code *is* Smalltalk; returning anything else is 
> effectively lying and is bound to get you into trouble.  I think Göran 
> was mostly using it because it's a spare instance variable on Class, 
> not because Namespace provides all the semantics an #environment should 
> (no doubt he'll correct me if I'm wrong).

Something like that. Note that Namespace is not the same thing as
Environment. For example, they are not related to each other in any way.
I have left the "self class environment" where I think they are fine,
and I have changed it back to Smalltalk in one or two places because it
could get weird otherwise.

But in essence I think I agree with Avi - maintaining the instvar may at
this point just make things more complex than needed. And as I said -
this code should be cleaned up a bit more if we intend to go with it.
Did you notice the class comments btw? :)

> Eventually, we may well find a use for that extra indirection, but I 
> don't think this is it.

Right.

regards, Göran



More information about the Squeak-dev mailing list