[Ann] Adding tree info to modules

Russell Allen mail at russell-allen.com
Fri Oct 24 02:11:48 UTC 2014

While I'm on a roll, the 'transporter-trees' branch of github.com/russellallen/self now has some changes to the modules/transporter code which adds the ability for modules to check their environment before fileIn with a preFileIn method, and gives them a 'tree' slot which allows multiple tree roots for source code.

Please checkout and let me know if anything breaks and if you think we should do this some other way.

Also feel free to improve on the minimum viable documentation below.

Cheers, Russell


By default, the tranporter writes out Self modules out to a tree rooted in the current working directory, or the 'objects' subdirectory of the directory given to the VM in the shell environment variable SELFWORKING_DIR.

Howevever Self modules have a slot 'tree' which can take a name of a tree. If the name of the tree is not an empty string, then the module writer will look up a directory in the dictionary found at ``modules init treeDictionary``.

This allows the developer to maintain several separate trees. For example::

  modules init registerTree: 'webserver' At: '/Users/username/webserver'.
  bootstrap read: 'webserver' From: 'applications' InTree: 'webserver'.
  modules webserver fileOut.


Each transporter module has a slot named ``revision`` containing a string version number. It is recommended that you use Semantic Versioning [#f10]_ so that the version of a module can be tested as follows::

  modules string version < (modules init moduleVersion copyOn: '1.0.0')
    ifTrue: [log warning: 'Old string version']

This test could be placed in the ``preFileIn`` slot of your module to ensure a sane file in environment before the rest of the file is read.

More information about the Self-interest mailing list