Next: 3.4 Control-flow
Up: 3 The Slate World
Previous: 3.2 Core Behaviors
  Contents
Slate objects, from the root objects down, all respond to the message
traits, which is conceptually shared behavior but is not
as binding as a class is. It returns an object which is, by convention,
the location to place shared behavior. Most Slate method definitions
are defined upon some object's Traits object. This is significant
because cloning an object with a traits delegation slot will result
in a new object with the same object delegated-to, so all methods
defined on that traits object apply to the new clone.
Traits objects also have their own traits object, which is Traits traits.
This has the important methods defined on it for deriving new prototypes
with new traits objects:
- myObject derive
- will return a new clone of the object
with a traits object which is cloned from the original's traits object,
and a delegation slot set between the traits objects.
- myObject deriveWith: mixinsArray
- will perform the same
operation, adding more delegation links to the traits of the array's
objects, in the given order, which achieves a structured, shared behavior
of multiple delegation. Note that the delegation link addition order
makes the right-most delegation target override the former ones in
that order. One interesting property of this method is that the elements
of mixinsArray do not have to be Derivable.
As with any method in Slate, these may be overridden to provide additional
automation and safety in line with their semantics.
Next: 3.4 Control-flow
Up: 3 The Slate World
Previous: 3.2 Core Behaviors
  Contents
The Slate Project
2003-07-29