[ANN] Another namespaces approach.

Michael van der Gulik mikevdg at gmail.com
Sat Sep 22 11:47:10 UTC 2007


Hi all.

Now by this stage you're probably all thoroughly sick of namespaces.

I've put together a more complex namespaces architecture. It's now available
on the PackageUniverses for 3.10. Note that this release is still very buggy
and for curious developers only.

To install: Go to Tools/NamespaceBrowser and install that.

Then browse to PasteUpMorph>>isSafeToServe, modify and save the source
there. (I noticed this bug just now).

Then evaluate: "NamespaceExamples openPackageManager."

This converts existing code in the image and eventually pops up a
PackageManager with four packages: Kernel, Collections, Morphic and Legacy
(which contains the SystemDictionary). Right-click on these and click
"Browse" and play around some. Then close Squeak, chuck the image away and
wait for the next announcement :-). Currently there's a NamespaceBrowser,
NamespaceWorkspace, and a package management tool where all the action
starts from.

Some documentation for my approach is at http://gulik.pbwiki.com/Namespaces.

Some advantages of this approach:

- It doesn't need the SystemDictionary, but will work happily alongside it.
It makes a couple of changes to the compiler etc, but these should not
affect the workings of the rest of Squeak. Classes in namespaces are not
stored in the SystemDictionary but are stored in packages (which again
aren't stored in the SystemDictionary either).

- You can load two (or more) versions of the same package into the same
image at the same time and make objects from either. Loading a package does
not modify any other classes currently in the image.

- Packages depends on other packages by UUID, and if you modify a package it
gets a new UUID. This means that your code will never suffer from dependency
problems and will always run in exactly the same environment you wrote and
tested it in. Bit-rot shouldn't happen unless you start changing the VM.

- You don't need to use haltOnce: any more. The system can run the code in a
read-only package (not yet supported...) and you can do your work on a
working copy of that package.

- Naming collisions are impossible (or at least they should be... not yet
tested).

- It doesn't need to be integrated into the official image because it can be
loaded as a Monticello package. I plan to work out a way to make .mcz or .st
files that use namespaces automatically load namespace support into the
image.

- It's probably compatible with Göran's approach :-). You can have two
namespace implementations in your image at the same time... if you really
want to.

Gulik.

-- 
http://people.squeakfoundation.org/person/mikevdg
http://gulik.pbwiki.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20070922/9f103613/attachment.htm


More information about the Squeak-dev mailing list