multiple classes with the same name, namespaces
lattam at mac.com
Sat May 27 17:00:43 UTC 2006
> Class names are not dynamic if you want source code to work. If you
> change the name of a class then you have to find code that refers to
> the class and patch it. If you only care about compiled code, and not
> source code, then class names are dynamic.
This brings up a point that has been bouncing around for a while. While
Smalltalk sees all things as objects, the one thing that is not currently an
object is source code. We store the original string from the user as the
master copy, and derive objects from that. This is the source of the whole
Class name thing, and the need for refactoring them. If we only kept the
objects (with things like comments intact) and regenerated the source on
need this would not be an issue. It would also allow richer literals and a
few other things. It could also support auto-formatting of all source code
if the user chose to do that. It would require that variable names and
comments be retained in the image, but with modern machines that should not
be a big deal. Done properly it would also resolve the case where different
intended classes have the same name, as their references would be different.
When editing the source the system could either prompt for desired class,
use the pre-existing reference as a guide, or treat non-unique class names
differently when generating source.
More information about the Squeak-dev