Quick comparison of two Namespaces proposals
Michael van der Gulik
mikevdg at gmail.com
Tue Sep 18 22:16:59 UTC 2007
On 9/19/07, goran at krampe.se <goran at krampe.se> wrote:
> "Michael van der Gulik" <mikevdg at gmail.com> wrote:
> > What do you mean by several packages defining names in the same
> > Are you talking about method overrides? Then like I said before, I can't
> > work out how to do this without creating a security issue (I'm planning
> > Packages containing completely untrusted code which can be securely
> > d locally).
> I am not talking about method overrides, no. I am simply talking about
> package P1 defining a class X in N1 and package P2 defining class Y in
> N1. Nothing magical. :)
My implementation handles this fine. In this case, you'd have P1 containing
N1::X (using Krampe notation) and P2 containing N1::Y. The import list of
your code using X and Y would include P1 and P2 (import lists contain only
other Namespaces, and Packages are Namespaces).
When your code contains the name "N1::X", then the compiler will search P1
(from the import list) for N1, then that N1 for X and find it (and continue
searching to make sure the name isn't ambiguous). When your code contains
the name "N2::X" then the compiler will search P1 (from the import list) for
N1, search that N1 for Y, not find it, search P2 (from the import list) for
N1, search that N1 for Y, find it and return it (and continue searching to
make sure it isn't ambiguous).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev