Quick comparison of two Namespaces proposals

Göran Krampe goran at krampe.se
Thu Sep 20 07:45:16 UTC 2007


Hi Michael!

>> If I understand you correctly (there are lots of assumptions here that I
>> am not totally getting) - you are saying:
>>
>> - Package IS a Namespace.
>> - Two packages CAN define names in the same namespace.
>>
>> I may be daft but I don't get it. So P1 "contains" N1 and so does P2?
>> And
>> a package IS a Namespace? So N1 can appear in multiple places in your
>> hierarchy, is that what you mean?
>>
>
> Well... kind of. I'll explain it in code:
>
> Package is a subclass of Namespace; Namespace is a subclass of Dictionary.
>
> p1 := Package new.
> n1 := Namespace new name: #Namespace1.
> p1 at: #Namespace1 put: n1. " should be p1 addNamespace: n1. "
> n1 at: #X put: X.
>
> p2 := Package new.
> n2 := Namespace new name: #Namespace1.
> p1 at: #Namespace1 put: n2.
> n2 at: #Y put: Y.
>
> Now, if you add both p1 and p2 to your local import list, you can refer to
> Namespace1.X and Namespace1.Y.
>
> Does this answer your question?

Ehm, well. :) It looks like a Package can contain any namespaces (like for
example one that you already have with the same name in another package)
and that the complete "tree" of the namespaces is the merged tree of all
packages in your image? But then I have a hard time seeing that a Package
ISA Namespace (subclass). Or perhaps the Namespace tree is in fact not a
tree at all.

And even if I am wrong... this feels complicated to me. But then again I
am pretty daft. ;)

regards, Göran




More information about the Squeak-dev mailing list