Anchor names are resolved in the anchor environment that is in effect at the time the anchor is read.
The basis for all anchor environments is the root environment. Conceptually, the root environments is a fixed mapping that binds every possible anchor to a mutable location. The location can store a native directory name or can be marked ``undefined''. Most locations initially start out undefined. The contents of each location is configurable (see Section 3.4).
At the time a CM description file
.cm refers to another
library's or library component's description file
.cm, it can
augment the current anchor environment with new bindings. The new
bindings are in effect while
.cm (including any description
files it mentions!) is being processed. If a new binding
binds an anchor name that was already bound in the current
environment3, then the old binding is being
hidden. The effect is scoping for anchor names.
Using CM's tool parameter mechanism (see Section 6.1), a new binding is specified as a pair of anchor name and anchor value. The value has the form of another path name (standard or native). Example:
a.cm (bind:(anchor:lib value:$mystuff/a-lib)
bind:(anchor:support value:$lib)
bind:(anchor:utils value:/home/bob/stuff/ML/utils))
As shown in this example, it is perfectly legal for the specification of the value to involve the use of another anchor. That anchor will be resolved in the original anchor environment. Thus, a path anchored at $lib in a.cm will be resolved using the binding for $mystuff that is currently in effect. The point here is that a re-configuration of the root environment that affects $mystuff now also affects how $lib is resolved as it occurs within a.cm.
CM processes the list of bind-directives ``in parallel.'' This means that the anchor $support will refer to the original meaning of $lib and is not being bound to $mystuff/a-lib/asupport.
The example also demonstrates that value-paths can be single anchors. In other words, the restriction that there has to be at least one arc after the anchor does not apply here. This makes it possible to ``rename'' anchors, or, to put it more precisely, for one anchor name to be established as an ``alias'' for another anchor name.