[Cuis-dev] Namespaces?

Luciano Notarfrancesco luchiano at gmail.com
Mon May 13 05:21:46 PDT 2019


Hi everybody,
Every now and then I wish we had namespaces. What's the simplest
namespace-like thing that could allows us to simultaneously load two
packages with clashing class names?

I've been thinking that it might be reasonable to make packages have
independent namespaces. Nothing complex like VW's, just Smalltalk for the
base image and then a global name in Smalltalk for each package namespace,
and package classes are accessible via sending a message to its namespace.
For example, if Morphic was an external package, loading it would create a
namespace named #Morphic in Smalltalk, and the classes in the Morphic
package would be compiled using this namespace instead of Smalltalk to
lookup globals, and it would delegate lookups to Smalltalk if it doesn't
know the requested keys. After loading the package you could use the class
HandMorph directly within methods compiled in the Morphic package, but
outside of it (in methods belonging to classes in the base image or in
other packages) you would have to do
    Morphic at: #HandMorph
or perhaps for convenience as a message like VW:
    Morphic HandMorph

Has anyone attempted to do anything like this? I just looked around for
five minutes and the impression I get is that it would be non-trivial,
there are a lots of references to Smalltalk and probably a lot of
subtleties to make all the tools work well. What do you think?

Thanks,
Luciano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190513/404a7c93/attachment.html>


More information about the Cuis-dev mailing list