Last updated at 9:17 am UTC on 25 November 2015
The attempt of creating Environments described below has been discontinued and is superseded by a new
Environments 2012 implementation.
What problem is being addressed
Environments addressed several problems
- Be able to load a package like ThingLab and not get conflicts in global names such as class Line.
- Be able to load such packages "in the twinkling of an eye" using ImageSegments.
- Uninstall simply by breaking one link.
- Support the ability to "hot swap" between, eg, two different versions of the File System
- Do this all wihout changing the appearance of a single line of code.
How it solves the problem
- Environments began by breaking the monolithic Smalltalk dictionary into a structured set of dictionaries, one for each module or package. The Environment was the dictionary for that package. This then provided the partitioning of the global namespace to avoid conflicts between packages and the base system, and between one package and another.
- All references to the internals of an environment were in the form of message send, as in ThingLab Line, or Midi Timbre. The first identifier here is a reference to an environmnet, the second is a capitalized message selector.
- By distributing the global name space among the various resident environments, there was no need to install or uninstall entries in a monolithic Smalltalk dictionary.
- By forcing all references into a package to be message sends, there was only one pointer holding onto the package. This meant it could be completely uninstalled by removing one reference, or that it could be swapped in or out using the high-performace ImageSegment mechanism.
- Similarly, the single assignment statment FileSystem := FileSystemV2 would suffice instantly and atomically to test a new FileSystem package.
What's cool about it
- Some partitioning of the global name space is essential for modular extension of the system. This one is simple.
- The capitalized selectors can be seen as a hack or as more palatable than dotted references.
- The use of message sends for inter-package references is very powerful because it allows a single root pointer per package.
- The synergy with ImageSegments is real: it was possible to load the entirety of ThingLab or the VMConstruction segment (500k) in about a tenth of a second.
- The early release of Environments came with a remarkable (if I do say so myself) reorganizeEverything method which broke up the system into a number of separate packages (envts), and then recompiled the entire system so that all global references worked as inter-package message sends.
- Environments did not solve the problem of "extensions" – methods to be installed in other packages. See the section in Modular Squeak on Isolated changes for a bold attempt at this that didn't really work.
- Environments got mixed into a project to modularize Squeak which unfortunately made several incompatible changes. We never tried to backtrack and do this right.
Back to New Modules