chickadee » prometheus » *the-root-object*

*the-root-object*class

This is the default root object. If not really intended otherwise, this should be used as the root of the object hierarchy in a program.

Root objects contain a number of slots by default.

 [message] clone

Return a clone of the message recipient. This creates a new object with a single slot, parent, which points to the cloned object.

 [message] add-value-slot! getter value
 [message] add-value-slot! getter setter value

Add a new value slot to the recipient. The value of the slot can be retrieved with the getter message. If a setter message is given, that message can be used to change the value of the slot.

 [message] add-method-slot! getter proc
 [message] add-method-slot! getter setter proc

Add a method to the recipient. Sending the object a getter message now invokes proc with the same arguments as the message, in addition to a self argument pointing to the current object and a resend procedure available to resend the message if the method does not want to handle it directly.

The setter message can later be used to change the procedure.

 [message] add-parent-slot! getter parent
 [message] add-parent-slot! getter setter parent

Add a parent slot to the recipient. Parent slots are searched for slots not found directly in the object. The setter message, if given, can be used to later change the value of the parent slot.

 [message] delete-slot! name

Delete the slot named name from the receiving object. This also removes the setter corresponding to name, if any. Beware that the parents might contain the same slot, so a message send can still succeed even after a slot is deleted.

 [message] immediate-slot-list

This message returns a list of slots in this object. The elements of the list are lists with four elements:

  • getter-name
  • setter-name
  • #f
  • type, which can be one of the symbols value, method or parent.
 [message] message-not-understood message args

This is received when the message message with arguments args to the object was not understood. The root object just signals an error.

 [message] ambiguous-message-send message args

This is received when the message message with arguments args to the object would have reached multiple parents. The root object just signals an error.