![]() | ![]() | ![]() | define-class | ![]() |
|
| class-name
({superclass-name}*)
[documentation] ({slot-specifier}*)
{class-option}*
=> new-class | [Macro] |
Purpose
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
| |
| documentation | A documentation string (not evaluated) | |
| slot-specifiers | See below | |
| class-options | See below | |
| new-class | A new or modified class object |
Returns
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-class-name boolean) | | |
(:export-accessors boolean) | | |
(: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*} | |
Terms
| class-name | A non-nil, non-keyword symbol that names a
class
| |
| initarg-list | An initialization argument list | |
| slot-name | A non-nil, non-keyword symbol
|
Description
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-unit-class
make-instance
with-generate-accessors-format
Examples
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
![]() | ![]() | ![]() | define-class | ![]() |