Next: , Previous: clone, Up: Objects Dictionary


defobject
— Macro: defobject {parent-objects} ({property-spec}*) option-spec*

=> new-object

     parent-objects ::= {object | (object*)}
     property-spec ::= (property-name property-value property-option*)
     property-name ::= symbol
     property-value ::= object
     property-option ::= {:reader {reader-message-name | nil}}* |
                         {:writer {writer-message-name | nil}}* |
                         {:accessor {reader-message-name | t | nil}}*
     message-name ::= {symbol | (quote (setf symbol))}
     option-spec ::= :nickname lisp-object |
                     :documentation docstring

Arguments and Values:

parent-object — an object.

property-name — a symbol, not evaluated.

property-value — a form, evaluated to produce the value for property.

reader/writer/accessor — can be supplied more than once for each property. If NIL is given for any of these, signals an error if there is another matching definition. :accessor creates both a reader and a writer with format (accessor-name sheep-object) (setf (accessor-name sheep-object) new-value). Providing T as the argument to :accessor automatically creates an accessor for that property using the given property name.

nickname — a form, evaluated to produce the nickname for new-object, preferably a symbol.

documentation — a string of documentation for the new sheep.

new-object — an object, constructed according to the arguments.

Description:

DEFOBJECT creates a new object with all the parent-objects as parents. After the new object has been initialized, direct-properties are added to it during SHARED-INIT, using (SETF PROPERTY-VALUE), based on property-spec.

Examples:

     (defobject () ((var "value"))) => #<Object [=STANDARD-OBJECT=] #x30004157569D>
     (defobject * ()) => #<Object [=STANDARD-OBJECT=] #x30004158008D>
     (object-parents *) => (#<Object [=STANDARD-OBJECT=] #x30004157569D>)
     (available-properties **) => (VAR NICKNAME)

Side Effects: