- make-hermes-objectprocedure
Return a new Hermes object which knows the basic messages.
[message] add-message! name handler [parent?]
This adds a message named name to the object, upon receiving which, handler is applied to self, resend, and the arguments to the message. If parent? is supplied and not false, this message returns a parent object. In this case, it must be callable with no arguments, and must not use resend.
[message] delete-message! name
Remove the handler for the message named name. This causes such messages to be handled by parent objects in the future again.
[message] %get-handler name receiver args visited
The message upon which inheritance in Hermes is built. This returns a procedure of no arguments which handles the receiving of the message. This is delayed so that Hermes can check for duplicate handlers, which would be an error.
Name is the name of the message we are looking for. Receiver is the original receiver of the message, to be used as the self argument to the handler procedure. Args is a list of arguments. Visited is a list of objects we have seen so far. This is used to detect cycles in the inheritance graph.
This message returns two values. The first one is the handler and the other one the object in which this handler was found. The handler value can also be one of two symbols to signify an error condition. If it's the symbol message-not-understood, then neither this object nor any parents knew how to handle this message. If it's ambiguous-message-send, the same message could be handled by multiple parents in the inheritance graph. The user needs to add a message which resends the ambiguous message unambiguously to the correct parent. In either case, the second return value is #f. The handler procedure itself accepts no arguments, and just runs the message.
It is absolutely sufficient for an object to handle only the %get-handler message to participate in the inheritance handling of Hermes.