next up previous contents index
Next: 3.12 Exceptions Up: 3 The Slate World Previous: 3.10 External Resources   Contents   Index

3.11 Paths

Since the environment is structured into namespaces and many types have so-called ``attribute types'' (for example, the iterator streams), it is helpful to have more than a name by which to refer to an object or its location in the system. The path library allows doing this with Path objects, which describe the sequence of slot traversals necessary to reach a particular object. A sub-variant called RootedPath remembers the specific origin object used for the path and follows the same protocol.

Path from: root to: target
creates a new Path object containing the necessary slot traversals to obtain the target object (the destination) from the given root (the origin). Paths are created by searching breadth-first through slot names; if the search completes without an identical match, Nil is returned.
to:
works like from:to: except that here is taken as the origin.
target
answers the target object as computed by following the slot names from the origin.
targetFrom:
answers the target object relative to the given one, taking it as the origin.
reduced
answers another equivalent Path object consisting of all non-delegation slots traversed. This gives a ``canonical'' or shortest path to the object.
expanded
answers another equivalent Path object consisting of all delegation slots required to traverse to reach the object directly.
root knows: target
answers whether there is a Path from the given root to the target.
isWellKnown
answers whether there is a Path from the lobby to the given object.
Path objects also respond to relevant Sequence protocols such as ; and isPrefixOf: among other paths.


next up previous contents index
Next: 3.12 Exceptions Up: 3 The Slate World Previous: 3.10 External Resources   Contents   Index
Brian Rice 2005-11-21