This is the nclasses Reference Manual, version 0.2.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Mar 15 07:05:10 2023 GMT+0.
The main system appears first, followed by any subsystem dependency.
nclasses
Simplify class like definitions with define-class and friends.
Atlas Engineer LLC
dwim.hu & Atlas Engineer LLC
Public Domain
0.2.0
moptilities
(system).
package.lisp
(file).
duplicates.lisp
(file).
defclass-star.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
nclasses/duplicates.lisp
package.lisp
(file).
nclasses
(system).
concatenate-symbol
(function).
fully-qualified-symbol-name
(function).
remf-keywords
(macro).
remove-keywords
(function).
nclasses/defclass-star.lisp
duplicates.lisp
(file).
nclasses
(system).
*allowed-slot-definition-properties*
(special variable).
always-dashed-predicate-name-transformer
(function).
default-accessor-name-transformer
(function).
default-initarg-name-transformer
(function).
default-predicate-name-transformer
(function).
default-slot-definition-transformer
(function).
default-type-inference
(function).
define-class
(macro).
define-condition*
(macro).
dwim-accessor-name-transformer
(function).
make-name-transformer
(macro).
question-mark-accessor-name-transformer
(function).
question-mark-predicate-name-transformer
(function).
*accessor-name-package*
(special variable).
*accessor-name-transformer*
(special variable).
*accessor-names*
(special variable).
*automatic-accessors-p*
(special variable).
*automatic-initargs-p*
(special variable).
*automatic-predicates-p*
(special variable).
*automatic-types-p*
(special variable).
*export-accessor-names-p*
(special variable).
*export-class-name-p*
(special variable).
*export-predicate-name-p*
(special variable).
*export-slot-names-p*
(special variable).
*initarg-name-transformer*
(special variable).
*predicate-name-transformer*
(special variable).
*slot-definition-transformer*
(special variable).
*slot-names*
(special variable).
*symbols-to-export*
(special variable).
*type-inference*
(special variable).
build-defclass-like-expansion
(function).
extract-options-into-bindings
(function).
hu.dwim.defclass-star-style-warning
(condition).
process-slot-definition
(function).
slot-name-package
(function).
slot-type-maybe-inherited
(function).
style-warn
(function).
Packages are listed by definition order.
nclasses
This library offers two helper macros:
- ‘nclasses:define-class’
- ‘nclasses:define-condition*’.
Compared to the standard macros, they accept extra options and slot definition
is smarter.
Example:
(define-class foo ()
((slot1 :initarg nil)
(slot2 "hello!")
(unexported-slot :export nil))
(:export-class-name-p t)
(:export-accessor-names-p t)
(:accessor-name-transformer #’nclasses:default-accessor-name-transformer))
In the above, all slot accessors are automatically defined using
‘nclasses:default-accessor-name-transformer’. They are also exported together with the
class name.
The initarg default to the keyword version of the slot symbol, unless it’s
explicitly set to NIL.
Notice that the second value of the slot definition, if not an option, is then
the initform.
See ‘nclasses:define-class’ for more details.
common-lisp
.
*allowed-slot-definition-properties*
(special variable).
always-dashed-predicate-name-transformer
(function).
default-accessor-name-transformer
(function).
default-initarg-name-transformer
(function).
default-predicate-name-transformer
(function).
default-slot-definition-transformer
(function).
default-type-inference
(function).
define-class
(macro).
define-condition*
(macro).
dwim-accessor-name-transformer
(function).
make-name-transformer
(macro).
question-mark-accessor-name-transformer
(function).
question-mark-predicate-name-transformer
(function).
*accessor-name-package*
(special variable).
*accessor-name-transformer*
(special variable).
*accessor-names*
(special variable).
*automatic-accessors-p*
(special variable).
*automatic-initargs-p*
(special variable).
*automatic-predicates-p*
(special variable).
*automatic-types-p*
(special variable).
*export-accessor-names-p*
(special variable).
*export-class-name-p*
(special variable).
*export-predicate-name-p*
(special variable).
*export-slot-names-p*
(special variable).
*initarg-name-transformer*
(special variable).
*predicate-name-transformer*
(special variable).
*slot-definition-transformer*
(special variable).
*slot-names*
(special variable).
*symbols-to-export*
(special variable).
*type-inference*
(special variable).
build-defclass-like-expansion
(function).
concatenate-symbol
(function).
extract-options-into-bindings
(function).
fully-qualified-symbol-name
(function).
hu.dwim.defclass-star-style-warning
(condition).
process-slot-definition
(function).
remf-keywords
(macro).
remove-keywords
(function).
slot-name-package
(function).
slot-type-maybe-inherited
(function).
style-warn
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Holds a list of keywords that are allowed in slot definitions (:accessor and :initarg are implicitly included).
Convenience wrapper of ‘defclass’.
It automates a lot of boilerplate (like exporting all the accessors of a class)
plus adds some new features.
Slot options:
- The initform can be specified as the second value.
- ‘:accessor’, ‘:reader’ and ‘:writer’ can be set to either a name, NIL or T.
If NIL, the method is not generated.
If T, the method is generated using the ‘:accessor-name-transformer’ class option value.
- The ‘:export’ option allows to control the slot-name export on a per-slot basis.
New class options (defaults are NIL unless specified):
- ‘:slot-definition-transformer’ (default: ‘default-slot-definition-transformer’).
A function that takes a SLOT-DEFINITION and returns a new one.
- ‘:accessor-name-package’: The package of the generated accessors. See
‘:accessor-name-transformer’. Some special values are accepted:
- ‘:slot-name’: The package of the slot-name.
- ‘:default’: The current package.
- ‘:accessor-name-transformer’ (default ‘default-accessor-name-transformer’).
A function of (SLOT-NAME SLOT-DEFINITION) arguments that returns the accessor
name (a symbol). Other transformer: ‘dwim-accessor-name-transformer’.
- ‘:automatic-accessors-p’: Whether to generate accessor names automatically for
all slots.
- ‘:initarg-name-transformer’ (default: ‘default-initarg-name-transformer’.)
A function of (SLOT-NAME SLOT-DEFINITION) arguments that returns the accessor
name (a symbol.
- ‘:automatic-initargs-p’ (default: T): Whether to generate accessor names
automatically for all slots.
- ‘:predicate-name-transformer’ (default: ‘default-predicate-name-transformer’).
A function of (SLOT-NAME SLOT-DEFINITION) arguments that returns the predicate
name (a symbol).
- ‘:automatic-predicates-p’ (default: T): Whether to generate a predicate
for the class.
- ‘:type-inference’ (default: ‘default-type-inference’).
Function that returns the type of a slot definition (with an initform). It
takes 3 arguments:
- The initform.
- The slot name.
- The rest of the slot definition.
- ‘:automatic-types-p’: Whether to generate the type automatically for all
slots. The type can still be specified manually with the ‘:type’ slot option.
- Self-explanatory export options (all NIL by default):
- ‘:export-class-name-p’
- ‘:export-accessor-names-p’
- ‘:export-slot-names-p’
- ‘:export-predicate-name’
To ‘define-condition’ what ‘define-class’ is to ‘defclass’. See ‘define-class’ for more details.
Return an accessor name transformer.
The unquoted ‘name’ symbol argument is substituted for the slot name.
Class option examples:
:accessor-name-transformer (make-name-transformer "FOO-" name "-BAR")
Use the slot name directly:
:accessor-name-transformer (make-name-transformer name)
Return predicate name that’s always suffixed with ’-p’.
Return an accessor name following the slot name NAME.
Return predicate name that’s suffixed with ’-p’ if NAME already contains a ’-’, or just ’p’ otherwise..
Converts illegal (list foo) :type declarations into simple list declarations.
Return type of INITFORM.
This is like ‘type-of’ but returns less specialized types for some common
subtypes, e.g. for "" return ’string instead of ‘(SIMPLE-ARRAY CHARACTER
(0))’.
Note that in a slot definition, ’() is inferred to be a list while NIL is
inferred to be a boolean.
If the slot is found in a finalized superclass, the inferred type is then that
of the superclass. If some superclass is not finalized, no type inference is
performed.
Non-basic form types are not inferred (returns nil).
Non-basic scalar types are derived to their own type (with ‘type-of’).
Return an accessor name using the slot name NAME suffixed with "-OF".
If the slot is a boolean not ending with a question mark, it is suffixed with "-P" instead.
If the slot ends with a question mark, the name is taken as is.
Return an accessor name using the slot name NAME suffixed with "-OF". If the slot is a boolean, it ensures the name is suffixed with "?".
Return predicate name that’s always suffixed with ’?’.
A package, or :slot-name means the home-package of the slot-name symbol and nil means *package*
A function that takes the class name and its definition as argument.
Return the name of the predicate function.
The predicate function returns true when the argument is a type of the ‘name’ class.
Function that returns the type of a slot definition (with an initform).
It takes 3 arguments:
- The initform.
- The slot name.
- The rest of the slot definition.
Removes the properties identified by KEYWORDS from PLACE.
Args are processed as parts of the result symbol with two exceptions except when a package is encountered then it is stored as the target package at intern.
Creates a copy of PLIST without the listed KEYWORDS.
simple-condition
.
style-warning
.
Jump to: | A B C D E F M P Q R S |
---|
Jump to: | A B C D E F M P Q R S |
---|
Jump to: | *
S |
---|
Jump to: | *
S |
---|
Jump to: | C D F H N P S |
---|
Jump to: | C D F H N P S |
---|