On 9/19/07, goran@krampe.se goran@krampe.se wrote:
Hi!
Hello :-).
"Michael van der Gulik" mikevdg@gmail.com wrote:
What do you mean by several packages defining names in the same
namespace?
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
on
Packages containing completely untrusted code which can be securely
execute=
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).
Michael.