Next: Oddballs
Up: Core Behaviors
Previous: Core Behaviors
  Contents
- Identity
- == returns whether the two arguments are identical,
i.e. the same object, and ~== is its negation. Value-equality
(= and its negation ~=) defaults to this.
- Printing
- print returns a printed (string) representation
of the object. printOn: places the result of printing onto
a designated Stream. This should be overridden for clarity.
- Delegation-testing
- isReally: returns whether the first
object has the second (or its traits object if it is not a Trait)
as one of its delegated objects, directly or indirectly.
- Kind-testing
- is: returns whether the first object has the
same kind as the second object, or some derived kind from the second
object's kind. By default, is: is isReally:; overrides
can allow the user to adapt or abuse this notion where delegation
isn't appropriate but kind-similarity still should hold. isSameAs:
answers whether the arguments have the same traits object.
- Hashing
- A quick way to sort by object value that makes searching
collections faster is the hash method, which by default hashes
on the object's identity (available separately as identityHash),
essentially by its birth address in memory. What's more important
about hashing is that this is how value-equality is established for
collections; if an object type overrides =, it must also override
the hash method's algorithm so that a = b
a hash = b hash.
- Cloning
- The clone method is fundamental for Slate objects.
It creates and returns a new object identical in slot names and values
to the argument object, but with a new unique identity. As such, it
has a very specific meaning and should only be used that way.
- Copying
- The copy method makes a value-equal (=)
object from the argument and returns the new object. This should be
overridden as necessary where = is overridden. The default
case is to clone the original object.
- Conversion/coercion
- the as: protocol provides default conversion
methods between types of objects in Slate. Some primitive types, such
as Number, override this. The as: method has a default
implementation on root objects: if no converter is found or if the
objects are not of the same type, the failure will raise a condition.
Precisely, the behavior of a as: b is to produce an object
based on a which is as much like b as possible.
- Slot-enumeration
- For each object, the Symbols naming its
slots and delegate slots can be accessed and iterated over, using
the accessors slotNames and delegateNames, which
work with the symbol names of the slots, or the iterators slotsDo:
and delegatesDo:, which iterate over the stored values themselves.
Next: Oddballs
Up: Core Behaviors
Previous: Core Behaviors
  Contents
Brian Rice
2004-08-24