Go to the first, previous, next, last section, table of contents.


A message is implemented as an instance of message class or its subclass. Note that the name of message classes is interned in the agentalk-message package.

Class: message

Message is the root class for a message class. Every message class definition should have this class as an ancestor.

Macro: define-message-class class ([ super ]) ({ slot-decl }*) &rest options

slot-decl ::= (slot-name [ :type type ]) | slot-name
options ::= (:documentation doc-string) 

The message class class is defined with its super class super. If super is not specified, message is assumed. type specifies the data type of a slot. However, this information is not utilized at all in the current Lisp version.


(define-message-class announcement ()
   ((specification :type string)
    (expiration :type integer)))

Note: The name of a message class and its slot names are interned in the agentalk-message package.

Function: create-message class receiver sender &rest slot-values

slot-values ::= { slot-name value }*

This function returns a message object, which is an instance of the class class. receiver specifies the name of a receiver agent or a wild-card (*) in case of broadcast. sender specifies the name of the sender. slot-name is a keyword (a symbol starting with :).


(create-message 'announcement "*" "ME"
                :specification "TASK1" :expiration 3003044053)

Generic Function: send-message message &rest args

Primary Method: send-message (message message) &rest ignored

Primary Method: send-message (class symbol) receiver sender &rest slot-values

When a message object (a CLOS instance) is passed to this method, message is actually sent. When a class name (a symbol) is passed as the first argument, the arguments are applied to the create-message function, and the returned message is actually sent. This method returns the message sent.

Function: get-message-sender message

This function returns the sender of message.

Function: get-message-slot-value message slot-name

This function returns the value of the slot slot-name of message. If such a slot does not exist, an error is signaled.

Note: Since a message is implemented as an instance of a CLOS class, slot-value can be used to access a slot of a message. However, this is not encouraged, since the slot-name is interned in a special package; get-message-slot-value uses the appropriate package.

Go to the first, previous, next, last section, table of contents.