Guaranį presents two additional features that enforce the separation of concerns between the base level and the meta level: (i) the meta configuration of an object is completely hidden from the base level and even from the meta level itself; and (ii) the initial meta-configuration of an object is determined by the meta-configurations of its creator and of its class, a mechanism we call meta-configuration propagation.
The first design decision implies that there is no way to find out what is the primary meta-object associated with an object. It is possible, however, to send arbitrary messages and reconfiguration requests to the components of the meta-configuration of an object, through the kernel of Guaranį.
Messages can be used to extend the MOP of Guaranį, as they allow meta-objects to exchange information even if they do not hold references to each other. Meta-objects that do not understand a message are supposed to ignore it, and composers are expected to forward messages to their components. The kernel operation that implements this mechanism is called broadcast.
A reconfiguration request carries a pair of meta-objects, suggesting that the first meta-object should be replaced with the second. A special value can be used to refer to the primary meta-object. It is up to the existing meta-configuration to decide whether the request is acceptable or not. However, if the base-level object is not reflective, an InstanceReconfigure message is broadcast to the meta-configurations of its class and of its superclasses. Their components can modify the suggested meta-configuration, for example, forcing it to remain empty.
1
In most object-oriented programming languages, creating an object consists of two steps: (i) allocating storage for the object, possibly initialized with default values, then (ii) invoking its constructor. We say that these steps are performed by the creator of the object.
In Guaranį, between these two steps, meta-configuration propagation takes place. The primary meta-object of the creator is provided with a meta-object for the new object. It may return null, a different meta-object or even itself, as a meta-object can belong to the meta-configurations of multiple objects. A composer is expected to forward this request to its components and to create a composer that delegates to the meta-objects returned by them.
After meta-configuration propagation, the kernel of Guaranį broadcasts a NewObject message to the meta-configuration of the class of the new object, so that its meta-objects can try to reconfigure it. Finally, the object is constructed, but the constructor invocation will be intercepted if the new object has become reflective.