To be replaced by output from the manual.
The Lobby
Every object reference which is not local to a block closure is sent to the enclosing namespace for resolution, which by default is the root namespace, the lobby
. The lobby
automatically contains a loopback slot referring to itself by that name. If you wish to add or arrange globals, you can use either implicit sends to the lobby
or explicitly reference it. (We usually consider it good style to directly reference it.)
Prototypes and Traits
Because of Slate's characterization of methods as annotated block closures, specifically that dispatch on an argument position is optional, no one object "owns" a given method. So Slate objects deal with their protocols via "roles"; that is, they store methods in different ways than their data slots. What results is that cloning an object does not result in methods defined upon it to dispatch on both the new and the old object for that position. The method will still refer to the old object.
All of that affects what conventions are useful in organizing the system. Slate adopts a system where the major exemplar objects (the prototypes) to be cloned into working objects have proper names, and they store the behavior which should be shared with clones in a delegation slot, the traits
slot. This slot holds an object which has its own traits, Traits traits
. As long as methods dispatch upon the traits of an object or its prototype, any clone of that object will use the same behavior, since the clone
operation produces a new object with the same slots and delegation slots' names and values.
Conversely, behavior which should act on a "singleton" kind of object or one a particular object considered as a value should dispatch on the object itself, to prevent the sharing of that behavior. The Boolean objects True
and False
are managed in this way (though they are not themselves cloneables).
Extending Shared Behavior
Slate has a derivation utility which helps manage shared behavior extensions. Any object which is a Derivable will have a traits
delegation slot with some traits-object as its value. The message derive
will return a new object, a clone, delegating to a new traits-object which in turn delegates to the ancestors traits via a slot named parent
.
To create a multiple-delegation situation of traits, a Derivable and an array of other objects is sent the deriveWith:
message. obj1 deriveWith: {obj2. obj3. obj4}
returns a new object with traits delegating to each of these arguments' traits in turn, left-to-right. That is, the leftmost will have the greatest precedence proceeding to the least precedence to the rightmost object. For reference, the delegation slots of the new object's traits object will have the names parent1
..parentN
, respectively.
The prototypes
namespace
The namespace lobby prototypes
is implicitly available to the lobby and its descendants. Prototypes and traits installed there are ones which should be globally-available, including Booleans, Collections, Streams, and Numeric types.
Other Important Globals
Console Input and Output
The objects ConsoleInput
and ConsoleOutput
are provided in the lobby as a ReadStream and a WriteStream representing console byte-level input/output.