Project Layers

Jeffrey J. Hallman m1jjh00 at frb.gov
Wed Nov 17 20:30:33 UTC 1999


As a Smalltalk and Squeak newbie, I confess that I don't really understand all
of the proposals being floated in this area.  Many of them seem overly
complicated to me, but perhaps that is my lack of Smalltalk experience
showing.  In my everyday work, I use a statistics package called S-Plus from
MathSoft, which is based on the S language originally developed by John
Chambers and others at Bell Labs.  S has a very simple way of handling
namespace and project issues that I'd like to describe.

Persistent objects in S reside in databases.  Databases can bedirectories,
list objects, or other user-defined objects.  Databases can be attached to, or
detached from, the search list. To find an object, the interpreter searches in
order (i) the current frame, (ii) the session frame, (iii) the first database
on the search list, (iv) the second database on the search list, and so on.
There is also a 'get' function that can retrieve any object from any database.
Similarly, assignments can be made to any frame or attached database, but by
default the current frame is used.  At the interactive level, the current
frame is the database attached at the first position in the search list.  

A more detailed explanation of how this works can be found in this paper:
http://netlib.bell-labs.com/cm/ms/departments/sia/doc/93.15.ps

My usual search list looks like this:

 [1] "/mrp/prod/splus/.Data"                data objects maintained by my section
 [2] "/mrp/prod/splus/.Functions"           functions maintained by my section
 [3] "/opt/splus/local/.Functions"          functions maintained by sys admin people
 [4] "/opt/splus/splus/.Functions"          came with the package
 [5] "/opt/splus/stat/.Functions"           ditto
 [6] "/opt/splus/s/.Functions"              ditto
 [7] "/opt/splus/s/.Datasets"               ditto
 [8] "/opt/splus/stat/.Datasets"            ditto
 [9] "/opt/splus/splus/.Datasets"           ditto
[10] "/opt/splus/library/trellis/.Data"     ditto

For some projects, I create other directories, e.g. my seasonal review system
is in /mrp/prod/srs, which has it's own .Data directory.  When I start S in
that directory, I have it attach /mrp/prod/srs/.Data at position 1 of the
search list instead of /mrp/prod/splus/.Data   This lets me maintain separate
project-specific versions of my data and function objects, while still
accessing functions maintained by my section and the sys admin people. 

The search list scheme is simple enough that I can thoroughly explain and
demonstrate it to a new user in less than 5 minutes.  Of course it doesn't
know anything about prerequisites, but I've never found that to be a problem.
When S starts, the first thing it does is look for a function named .First to
execute.  I created a section version of .First that always gets executed. It
handles section-specific initializations, including attachments to the
search list,  and then looks for a .Second function to execute.  Different
projects can redefine .Second as required to check prerequisites and handle
other initialization tasks.  

Jeff





More information about the Squeak-dev mailing list