Squeak and Namespaces

Göran Krampe goran at krampe.se
Fri Dec 1 10:44:38 UTC 2006


> On Dec 1, 2006, at 8:49 , Göran Krampe wrote:
>>> download some project that uses your namespaces a lot, and it
>>> happens to
>>> define Array.  Now my entire image has "Kernel::Array" everywhere,
>>> right?
>>
>> Well, first of all I mistakenly said in one post that the basic image
>> would use the Kernel:: space. That was wrong (it has been a while
>> since we
>> discussed this before and my memory needed some kickstarting) - I
>> instead
>> advocate basic classes to continue being in the current global
>> space (=no
>> prefix).
>>
>> And given that - then no, it would still say Array.
>
> But if I have my own Array class it would then always show as
> My::Array, to be distinguishable from the core Array, right?

Yes, well, depending again on your policy. If you play with it, it would
today probably show up as "Array" IF it is a reference from a method in a
class in My:: (a so called "local" reference). But again, this is just
policy.

For example, we might want My::Bar to show as "Bar" in code living in
My::, even if we have Foo::Bar in the system - BUT... if there is a Bar in
the system (a regular global - like Array) then we might want to show the
full name My::Bar *even* if it is a local reference - to make it very
clear that this is indeed not the regular Bar.

So in which situations we would like to only show the abbreviated name -
even when there are other such in the system - can be discussed at great
length - but it is just "policy".

regards, Göran




More information about the Squeak-dev mailing list