29 Support Classes for Objects: ObjectSupport

# 29 Support Classes for Objects: `ObjectSupport`

This module contains classes that provide generic functionality for objects: Organizing objects in hierarchies and reflection of objects.

## 29.1 Classes for Master/Slave Behaviour

An instance `MasterO` of class `Object.master` becomes a master of an `Object.slave` object when the latter receives the message `becomeSlave(``MasterO``)`.

Methods for Masters

`init`

  > `init()`

  initialization; mandatory for internal reasons.

`getSlaves`

  > `getSlaves(``?SlaveOs``)`

  returns the list of current slaves.

An instance of `Object.slave` becomes a slave of an `Object.master` object `MasterO` when it receives the message `becomeSlave(``MasterO``)`.

Methods for Slaves

`becomeSlave`

  > `becomeSlave(``+MasterO``)`

  makes `self` become a slave of `MasterO`. `self` must not yet be a slave of any object, else an exception is raised.

`isFree`

  > `isFree(``?B``)`

  tests whether `self` is not the slave of any object.

`free`

  > `free()`

  frees `self`. `self` must be the slave of some object, else an exception is raised.

## 29.2 Reflecting Objects

The unsited class `ObjectSupport.reflect` provides the following methods:

`clone`

  > `clone(``+O``)`

  returns a clone of `self` (that is, features and current attribute values are equal).

`toChunk`

  > `toChunk(``?Ch``)`

  returns a chunk that contains information on current attribute values and features.

`fromChunk`

  > `fromChunk(``+Ch``)`

  Sets features and attributes according to chunk `Ch`. `Ch` must have been created with `toChunk`. The current object must have the same class as that from which the chunk was computed.