defcmGBBopen Toolsdo-untildefine-classGoTo Top

define-class   class-name ({superclass-name}*) ({slot-specifier}*) {class-option}* => new-class[Macro]

Extended macro for defining or redefining a class.

Package   :gbbopen-tools

Module   :gbbopen-tools

Arguments and values

class-name     A non-nil, non-keyword symbol that names the class
superclass-name     A non-nil, non-keyword symbol that specifies a direct superclass of the class class-name
slot-specifiers     See below
class-options     See below
new-class     A new or modified class object

The newly defined or modified class object.

Detailed syntax

slot-specifier ::= slot-name |
(slot-name [[slot-option]])

slot-option ::= {:accessor reader-function-name}* |
{:allocation allocation-type} |
{:documentation string} |
{:initarg initarg-name}* |
{:initform form} |
{:reader reader-function-name}* |
{:type type-specifier} |
{:writer writer-function-name}*
class-option ::= (:default-initargs . initarg-list) |
(:documentation string) |
(:export-accessors boolean) |
(:export-class-name boolean) |
(:export-slot-names slots-specifier) |
(:generate-accessors slots-specifier) |
(:generate-accessors-format {:prefix | :suffix} |
(:generate-accessors-prefix {string | symbol}) |
(:generate-accessors-suffix {string | symbol}) |
(:generate-initargs slots-specifier) |
(:metaclass class-name)
slots-specifier ::= nil | t | included-slot-name* |
{t :exclude excluded-slot-name*}


class-name     A non-nil, non-keyword symbol that names a class
documentation     A documentation string
initarg-list     An initialization argument list
slot-name     A non-nil, non-keyword symbol

Each superclass-name argument specifies a direct superclass of the new class. If the superclass list is empty, then the direct superclass defaults to the single class standard-object.

The :metaclass class option, if specified, must be a subclass of standard-class. The default metaclass value is standard-class.

See also

Define a class, rectangle, generating “-of” slot accessors:

  > (define-class rectangle (point)
      (length width))
  #<standard-class rectangle>

Define a class, foo, generating class-name.slot-name slot accessors:

  > (define-class foo ()
      ((slot :initform ':uninitialized))
      (:generate-accessors-format :prefix))
  #<standard-class foo>

The GBBopen Project

defcmGBBopen Toolsdo-untildefine-classGoTo Top