The moptilities Reference Manual

This is the moptilities Reference Manual, version 0.3.13, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:06:56 2024 GMT+0.

Table of Contents


1 Systems

The main system appears first, followed by any subsystem dependency.


1.1 moptilities

Common Lisp MOP utilities

Maintainer

Gary Warren King <>

Author

Gary Warren King <>

License

MIT Style license

Long Description

MOP utilities provide a common interface between lisps and make the MOP easier to use.

Version

0.3.13

Dependencies
  • closer-mop (system).
  • sb-introspect (system)., required, for feature :sbcl
Source

moptilities.asd.

Child Components

2 Modules

Modules are listed depth-first from the system components tree.


2.1 moptilities/dev

Source

moptilities.asd.

Parent Component

moptilities (system).

Child Components

2.2 moptilities/website

Source

moptilities.asd.

Parent Component

moptilities (system).

Child Component

source (module).


2.3 moptilities/website/source

Source

moptilities.asd.

Parent Component

website (module).

Child Component

index.md (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 moptilities/moptilities.asd

Source

moptilities.asd.

Parent Component

moptilities (system).

ASDF Systems

moptilities.


3.1.2 moptilities/dev/moptilities.lisp

Source

moptilities.asd.

Parent Component

dev (module).

Packages

metabang.moptilities.

Public Interface
Internals

3.2 Static


3.2.1 moptilities/dev/notes.text

Source

moptilities.asd.

Parent Component

dev (module).


3.2.2 moptilities/website/source/index.md

Source

moptilities.asd.

Parent Component

source (module).


4 Packages

Packages are listed by definition order.


4.1 metabang.moptilities

Moptilities builds on the Lisp Meta-Object Protocol (**MOP**).

Source

moptilities.lisp.

Nicknames
  • mopu
  • moptilities
Use List

closer-common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *debugging-finalization*

When true, finalization messages are printed to *debug-io*

Package

metabang.moptilities.

Source

moptilities.lisp.


5.1.2 Ordinary functions

Function: care-when-finalized (object)

Ensures the when-finalized is called on the object just before it is garbage collected.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: default-initargs (class-specifier)

Returns a list of default initarg information for the class-specifier. This list consists of triples in the format <initarg value function>. The initarg is the initarg corresponding to the default-initarg; the value is the value it will default to and the function is a function of zero-arguments that returns value... (this is subject to minor changes).

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: direct-specializers-of (thing &key writers? readers? other? short-form?)

Returns a list of the direct specializers of thing. Thing can a class, object representing a class or symbol naming a class. The keyword arguments :readers?, :writers?, and :other? control which specializers are returned (reader methods, writer methods and other methods respectively). The keyword argument :short-form? controls whether a list of methods is returned or just a list of names.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: direct-subclasses (thing)

Returns the immediate subclasses of thing. Thing can be a class, object or symbol naming a class.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: direct-superclasses (thing)

Returns the immediate superclasses of thing. Thing can be a class, object or symbol naming a class.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: finalize-class-if-necessary (thing)

Finalizes thing if necessary. Thing can be a class, object or symbol naming a class. Returns the class of thing.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: function-arglist (symbol)

Returns two values, the arglist of symbol

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: generic-functions (thing)

Returns a list of all of the direct generic-functions associated with thing. Thing can be a class, object, or symbol naming a class.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: ignore-finalization (object)

Prevents care-when-finalized from being called on object just before it is garbage collected.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: leaf-class-p (thing)

Returns true if the class has no subclasses.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: leaf-subclasses (thing)

Returns a list of subclasses of thing that have no subclasses of their own; i.e., the leaves of the class tree rooted at thing. Thing can be a class, object or symbol naming a class.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: map-methods (thing fn)

Applys fn to all of the direct methods of thing (which can be a class, object or symbol naming a class). The function should take two arguments: a generic function and a method.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: map-subclasses (class fn &key proper?)

Applies fn to each subclass of class. If proper? is true, then
the class itself is not included in the mapping. Proper? defaults to nil.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: mopu-class-initargs (thing)
Package

metabang.moptilities.

Source

moptilities.lisp.

Function: remove-generic-function (function-designator)
Package

metabang.moptilities.

Source

moptilities.lisp.

Function: remove-methods (class-specifier &rest args &key dry-run? verbose? ignore-errors?)

Removes all methods associated with class-specifier. Class-specifier can be a class, object representing a class or symbol naming a class. If dry-run? is true (and verbose? is also true), then the methods that would be removed are printed but no methods are actually removed. Returns the number of methods that are removed (or that would have been removed if dry-run? is true).

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: remove-methods-if (class-specifier predicate &key dry-run? verbose? ignore-errors?)

Removes all methods associated with class-specifier that pass a predicate. Class-specifier can be a class, object representing a class or symbol naming a class. The predicate should be a function of two arguments: a generic-function and a method. If dry-run? is true (and verbose? is also true), then the methods that would be removed are printed but no methods are actually removed. Returns the number of methods that are removed (or that would have been removed if dry-run? is true).

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: specializers-of (class &rest args &key short-form? writers? readers? other? ignore-classes)

Like direct-specializers-of but returns all the specializers, not just the direct ones.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: subclasses (class &key proper?)

Returns the subclasses of ‘class‘.

Class may be a symbol naming a class, a instance of a class or a class object. If ‘proper?‘ is true (the default) then the class itself will _not_ be included in the result. If ‘proper?‘ is nil, then it will.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: superclasses (thing &key proper?)

Returns a list of superclasses of thing. Thing can be a class, object or symbol naming a class. The list of classes returned is ’proper’; it does not include the class itself.

Package

metabang.moptilities.

Source

moptilities.lisp.


5.1.3 Generic functions

Generic Function: class-name-of (thing)

Returns the name of thing’s class.

Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: class-name-of ((thing standard-object))
Method: class-name-of ((thing class))
Generic Function: copy-template (object)

Suppose you make an instance of the class foo:

(defclass foo ()
((test :accessor test :initform #’equal :initarg :test)))

(setf *foo* (make-instance ’foo :test #’eql))

Its ‘test‘ slot will be set to #’eql:

(test *foo*) => #’eql

If you want to make a structural clone (for lack of a better term) of ‘*foo*‘, you might try:

(setf *new-foo* (make-instance (type-of *foo*)))

But ‘*new-foo*‘’s test slot won’t be set properly:

(test *new-foo*) => #’equal

For simple classes, this is no problem but suppose we have
a graph from [CL-Graph][] and want to make a copy of that:

(make-graph (type-of old-graph)
:vertex-test (vertex-test old-graph)
:vertex-key (vertex-key old-graph)
:edge-test (edge-test old-graph)
:edge-key (edge-key old-graph)
:default-edge-type (default-edge-type old-graph) :default-edge-class (default-edge-class old-graph) :directed-edge-class (directed-edge-class old-graph) :undirected-edge-class (undirected-edge-class old-graph))))

Yuck!

Copy-template is a reasonable, though not perfect, solution to this problem; it creates a structural copy of an object such that the copy has all of its initargs correctly set.

[CL-Graph]: http://common-lisp.net/projects/cl-graph/

Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: copy-template ((object standard-object))
Generic Function: direct-slot-names (class-specifier)

Returns a list of the names of the slots that are defined _directly_ in the class-specifier (as opposed to slots defined in superclasses).

Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: direct-slot-names ((class symbol))
Method: direct-slot-names ((class standard-object))
Method: direct-slot-names ((class class))
Generic Function: eql-specializer-p (thing)

If thing is an eql-specializer, returns a representation of thing as (eql <object>).

Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: eql-specializer-p ((thing eql-specializer))
Method: eql-specializer-p (thing)
Generic Function: get-class (thing &key error?)

Returns the class of thing or nil if the class cannot be found. Thing can be a class, an object representing a class or a symbol naming a class. Get-class is like find-class only not as particular.

Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: get-class ((thing symbol) &key error?)
Method: get-class ((thing standard-object) &key error?)
Method: get-class (thing &key error?)
Method: get-class ((thing class) &key error?)
Generic Function: get-method (function qualifiers &rest specializers)
Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: get-method ((function symbol) qualifiers &rest specializers)
Method: get-method ((function standard-generic-function) qualifiers &rest specializers)
Generic Function: get-slot-definition (class slot-name)

Returns the slot-definition for the slot named ‘slot-name‘ in the class specified by ‘class-specifier‘. Also returns (as a second value) true if the slot is an indirect slot of the class.

Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: get-slot-definition (class-specifier slot-name)
Generic Function: method-name (method)
Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: method-name ((method standard-method))
Generic Function: reader-method-p (thing)

Returns true if thing is a reader method (i.e., a subclass of standard-reader-method).

Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: reader-method-p ((m standard-reader-method))
Method: reader-method-p (m)
Generic Function: slot-names (class)

Returns a list of the names of the slots of a class ~ (including both direct and inherited slots). It’s like ~ class-slot-names but on the class, not an instance of the class.

Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: slot-names ((class class))
Method: slot-names ((class symbol))
Method: slot-names ((class standard-object))
Method: slot-names ((class structure-object))
Generic Function: slot-properties (class-specifier slot-name)

Returns a property list describing the slot named slot-name in class-specifier.

Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: slot-properties ((class symbol) slot-name)
Method: slot-properties ((object standard-object) slot-name)
Method: slot-properties ((class class) slot-name)
Generic Function: when-finalized (thing)

Called just before an object is garbage collected if care-when-finalize has been called on the object.

Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: when-finalized :around (object)
Method: when-finalized (object)
Generic Function: writer-method-p (thing)

Returns true if thing is a writer method (i.e., a subclass of standard-writer-method).

Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: writer-method-p ((m standard-writer-method))
Method: writer-method-p (m)

5.2 Internals


5.2.1 Macros

Macro: nyi (function-name &rest args)

Signals an error saying that ‘function-name‘ is not yet implemented. The ‘args‘ are ignored.

Package

metabang.moptilities.

Source

moptilities.lisp.


5.2.2 Ordinary functions

Function: get-structure (name &optional errorp)

get-structure name

If ‘name’ has been defined as a structure then return its description. Otherwise signal an error if errorp is t.

Package

metabang.moptilities.

Source

moptilities.lisp.

Function: in-order-p (c1 c2)
Package

metabang.moptilities.

Source

moptilities.lisp.


5.2.3 Generic functions

Generic Function: get-function (function-designator)
Package

metabang.moptilities.

Source

moptilities.lisp.

Methods
Method: get-function ((function symbol))
Method: get-function ((function standard-generic-function))

Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   C   D   E   F   G   I   L   M   N   R   S   W  
Index Entry  Section

C
care-when-finalized: Public ordinary functions
class-name-of: Public generic functions
class-name-of: Public generic functions
class-name-of: Public generic functions
copy-template: Public generic functions
copy-template: Public generic functions

D
default-initargs: Public ordinary functions
direct-slot-names: Public generic functions
direct-slot-names: Public generic functions
direct-slot-names: Public generic functions
direct-slot-names: Public generic functions
direct-specializers-of: Public ordinary functions
direct-subclasses: Public ordinary functions
direct-superclasses: Public ordinary functions

E
eql-specializer-p: Public generic functions
eql-specializer-p: Public generic functions
eql-specializer-p: Public generic functions

F
finalize-class-if-necessary: Public ordinary functions
Function, care-when-finalized: Public ordinary functions
Function, default-initargs: Public ordinary functions
Function, direct-specializers-of: Public ordinary functions
Function, direct-subclasses: Public ordinary functions
Function, direct-superclasses: Public ordinary functions
Function, finalize-class-if-necessary: Public ordinary functions
Function, function-arglist: Public ordinary functions
Function, generic-functions: Public ordinary functions
Function, get-structure: Private ordinary functions
Function, ignore-finalization: Public ordinary functions
Function, in-order-p: Private ordinary functions
Function, leaf-class-p: Public ordinary functions
Function, leaf-subclasses: Public ordinary functions
Function, map-methods: Public ordinary functions
Function, map-subclasses: Public ordinary functions
Function, mopu-class-initargs: Public ordinary functions
Function, remove-generic-function: Public ordinary functions
Function, remove-methods: Public ordinary functions
Function, remove-methods-if: Public ordinary functions
Function, specializers-of: Public ordinary functions
Function, subclasses: Public ordinary functions
Function, superclasses: Public ordinary functions
function-arglist: Public ordinary functions

G
Generic Function, class-name-of: Public generic functions
Generic Function, copy-template: Public generic functions
Generic Function, direct-slot-names: Public generic functions
Generic Function, eql-specializer-p: Public generic functions
Generic Function, get-class: Public generic functions
Generic Function, get-function: Private generic functions
Generic Function, get-method: Public generic functions
Generic Function, get-slot-definition: Public generic functions
Generic Function, method-name: Public generic functions
Generic Function, reader-method-p: Public generic functions
Generic Function, slot-names: Public generic functions
Generic Function, slot-properties: Public generic functions
Generic Function, when-finalized: Public generic functions
Generic Function, writer-method-p: Public generic functions
generic-functions: Public ordinary functions
get-class: Public generic functions
get-class: Public generic functions
get-class: Public generic functions
get-class: Public generic functions
get-class: Public generic functions
get-function: Private generic functions
get-function: Private generic functions
get-function: Private generic functions
get-method: Public generic functions
get-method: Public generic functions
get-method: Public generic functions
get-slot-definition: Public generic functions
get-slot-definition: Public generic functions
get-structure: Private ordinary functions

I
ignore-finalization: Public ordinary functions
in-order-p: Private ordinary functions

L
leaf-class-p: Public ordinary functions
leaf-subclasses: Public ordinary functions

M
Macro, nyi: Private macros
map-methods: Public ordinary functions
map-subclasses: Public ordinary functions
Method, class-name-of: Public generic functions
Method, class-name-of: Public generic functions
Method, copy-template: Public generic functions
Method, direct-slot-names: Public generic functions
Method, direct-slot-names: Public generic functions
Method, direct-slot-names: Public generic functions
Method, eql-specializer-p: Public generic functions
Method, eql-specializer-p: Public generic functions
Method, get-class: Public generic functions
Method, get-class: Public generic functions
Method, get-class: Public generic functions
Method, get-class: Public generic functions
Method, get-function: Private generic functions
Method, get-function: Private generic functions
Method, get-method: Public generic functions
Method, get-method: Public generic functions
Method, get-slot-definition: Public generic functions
Method, method-name: Public generic functions
Method, reader-method-p: Public generic functions
Method, reader-method-p: Public generic functions
Method, slot-names: Public generic functions
Method, slot-names: Public generic functions
Method, slot-names: Public generic functions
Method, slot-names: Public generic functions
Method, slot-properties: Public generic functions
Method, slot-properties: Public generic functions
Method, slot-properties: Public generic functions
Method, when-finalized: Public generic functions
Method, when-finalized: Public generic functions
Method, writer-method-p: Public generic functions
Method, writer-method-p: Public generic functions
method-name: Public generic functions
method-name: Public generic functions
mopu-class-initargs: Public ordinary functions

N
nyi: Private macros

R
reader-method-p: Public generic functions
reader-method-p: Public generic functions
reader-method-p: Public generic functions
remove-generic-function: Public ordinary functions
remove-methods: Public ordinary functions
remove-methods-if: Public ordinary functions

S
slot-names: Public generic functions
slot-names: Public generic functions
slot-names: Public generic functions
slot-names: Public generic functions
slot-names: Public generic functions
slot-properties: Public generic functions
slot-properties: Public generic functions
slot-properties: Public generic functions
slot-properties: Public generic functions
specializers-of: Public ordinary functions
subclasses: Public ordinary functions
superclasses: Public ordinary functions

W
when-finalized: Public generic functions
when-finalized: Public generic functions
when-finalized: Public generic functions
writer-method-p: Public generic functions
writer-method-p: Public generic functions
writer-method-p: Public generic functions


A.3 Variables