DefaultRegistryDoc.tioga
Created Friday, June 15, 1984 4:07 pm PDT
Last edited by Eric Nickell, June 26, 1984 2:33:34 pm PDT
DefaultRegistry
1. Introduction
DefaultRegistry is a package that will allow a client package to get a full Grapevine RName (including a registry) starting with a name, which may or may not have a registry. The package does not check to see whether or not the resulting user name is a valid Grapevine RName.
2. Basic Use
For most clients, only one procedure in the interface is of any interest: MakeRegistryExplicit, which takes and returns a rope. The returned rope is chosen as follows:
1. If the input rope contains a period, then return it unchanged.
2. If there is a Default.DefaultRegistry entry in the user profile, then append its token as the registry to use.
3. Append the current user's registry to the rope.
Examples:
MakeRegistryExplicit["TBear.moscow"] returns "TBear.moscow"
MakeRegistryExplicit["TBear"] returns "TBear.paris" if the user profile contains
Default.DefaultRegistry: paris
MakeRegistryExplicit["TBear"] returns "TBear.london" if the user profile contains no Default.DefaultRegistry entry, and the registry of the Cedar user on which this package is run is "london".
3. All the Gory (i.e. "copiously bloody") Details
In actual fact, MakeRegistryExplicit takes two other arguments which are typically defaulted.
The first of these is packages, a list of atoms, whose default is [$Default]. This is the list of entries to check for in the user profile. Including the atom $Default, for example, will make DefaultRegistry look for the user profile entry "Default.DefaultRegistry". Including the atom $Gripe will make DefaultRegistry look for the user profile entry "Gripe.DefaultRegistry". If MakeRegistryExplicit does check the user profile, then it will append the registry of the first atom in the list with a corresponding user profile entry. Without clear reason, client packages which pass this argument should include $Default at the end of the list, like:
MakeRegistryExplicit[nameHeTypeIn, LIST[$Gripe, $Default]];
which (assuming this is the Gripe package) will look first for a Gripe.DefaultRegistry entry, and then for a Default.DefaultRegistry entry.
The second argument which is typically defaulted is defaultDefault. This is the registry appended if the rope does not contain a period, and there is no user profile entry if found corresponding to one of the atoms in packages. Therefore, the real rules, given in section 2 in simplified form are:
1. If the input rope contains a period, then return it unchanged.
2. If there is a .DefaultRegistry corresponding to any of the atoms in packages, then append its token as the registry to use. If more than one of the atoms would match, then use the first.
3. Append defaultDefault as the registry. (As well as the period, of course...)
4. Other features
There are two other procedures available to the user, GetDefaultRegistry and UsersRegistry.
GetDefaultRegistry takes packages and defaultDefault (same as for MakeRegistryExplicit), and returns as a rope the registry that would be defaulted to according to rules 2 and 3 above.
UsersRegistry returns the current Cedar user's registry. Notice that this is the default defaultDefault. (Whew! what a tongue-twister...)