Hi!
stephane ducasse stephane.ducasse@free.fr wrote:
- Imports are done in your code "per Namespace" which is immensely
better than like for example in Java where it is per class (well, per file, but anyway). It is still though the major difference with my proposal in which there are *no* explicit imports at all.
the problem with per namespace is that you can get unanticipated conflicts. here is a scenario that klaus from Smalltalk/x explained to me once
you have two namespace
N1 A
N2 import N1 B method foo ^ B
everthing compiles
now you add a new class B in N1 and the system does not bark....
a while later you recompile the method foo and now you may be in trouble.
Ok, so to explain your use case further - before N1 had a B, the foo method was obviously bound to the B in N2 - because there was no other B. Then you added another B to N1 and then recompile foo and now there are two B-choices - the local one in N2 or the imported one in N1, right?
In my proposal this is not a problem at all, this is what would happen:
First we have a class named N1::A and a class named N2::B. There is no import (since I don't have that concept at all). When typing in method N2::B>>foo and typing "B" nothing strange or odd will happen - as long as there is no other B around in the image (in any other namespace) Squeak will resolve it to N2::B and the *source* stored in method foo will be:
^ N2::B
...BUT it will *look* like "^ B" in the browsers because the short form is enough - there is no other B around so we render and accept the short form "B".
Now someone creates another B in the image - N1::B. After that we browse foo and it still renders in short form. How is that? Well, if the reference would have been to a class in ANOTHER namespace (non local) then it suddenly would render like "^ N2::B" because the short form is no longer "enough". So there is a policy to accept and render short forms even if there are multiple Bs *if* the reference is LOCAL - which is the case here.
Anyway, so what if we recompile then? No problem, it is in fact NOTHING different from now. The reference was always FULLY QUALIFIED in the source and thus a recompile is no problem at all.
regards, Göran