Common Lisp Package: METABANG.MOPTILITIES

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

README:

FUNCTION

Public

- (NUMBER &REST MORE-NUMBERS)

Subtract the second and all subsequent arguments from the first; or with one argument, negate the first argument.

CARE-WHEN-FINALIZED (OBJECT)

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

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).

DIRECT-SPECIALIZERS-OF (THING &KEY (WRITERS? T) (READERS? T) (OTHER? T) (SHORT-FORM? T))

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.

DIRECT-SUBCLASSES (THING)

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

DIRECT-SUPERCLASSES (THING)

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

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.

FUNCTION-ARGLIST (SYMBOL)

Returns two values, the arglist of symbol

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.

IGNORE-FINALIZATION (OBJECT)

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

LEAF-CLASS-P (THING)

Returns true if the class has no subclasses.

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.

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.

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.

REMOVE-METHODS (CLASS-SPECIFIER &REST ARGS &KEY (DRY-RUN? NIL) (VERBOSE? DRY-RUN?) (IGNORE-ERRORS? NIL))

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).

REMOVE-METHODS-IF (CLASS-SPECIFIER PREDICATE &KEY (DRY-RUN? NIL) (VERBOSE? DRY-RUN?) (IGNORE-ERRORS? NIL))

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).

SPECIALIZERS-OF (CLASS &REST ARGS &KEY SHORT-FORM? WRITERS? READERS? OTHER? (IGNORE-CLASSES '(T STANDARD-OBJECT)))

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

SUBCLASSES (CLASS &KEY (PROPER? T))

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.

SUPERCLASSES (THING &KEY (PROPER? T))

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.

Undocumented

MOPU-CLASS-INITARGS (THING)

REMOVE-GENERIC-FUNCTION (FUNCTION-DESIGNATOR)

SUBCLASSP (CLASS SUPERCLASS)

Private

GET-STRUCTURE (NAME &OPTIONAL (ERRORP T))

get-structure name If `name' has been defined as a structure then return its description. Otherwise signal an error if errorp is t.

Undocumented

IN-ORDER-P (C1 C2)

MACRO

Private

NYI (FUNCTION-NAME &REST ARGS)

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

GENERIC-FUNCTION

Public

CLASS-NAME-OF (THING)

Returns the name of thing's class.

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/

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).

EQL-SPECIALIZER-P (THING)

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

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.

GET-METHOD (FUNCTION QUALIFIERS &REST SPECIALIZERS)

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.

READER-METHOD-P (THING)

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

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.

SLOT-PROPERTIES (CLASS-SPECIFIER SLOT-NAME)

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

WHEN-FINALIZED (THING)

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

WRITER-METHOD-P (THING)

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

Undocumented

GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER (GF)

GENERIC-FUNCTION-LAMBDA-LIST (GF)

SETFGENERIC-FUNCTION-NAME (NEW-VALUE STANDARD-GENERIC-FUNCTION)

METHOD-NAME (METHOD)

Private

GET-FUNCTION (FUNCTION-DESIGNATOR)

SLOT-ACCESSOR

Public

Undocumented

GENERIC-FUNCTION-DECLARATIONS (STANDARD-GENERIC-FUNCTION)

SETFGENERIC-FUNCTION-DECLARATIONS (NEW-VALUE STANDARD-GENERIC-FUNCTION)

GENERIC-FUNCTION-METHOD-CLASS (STANDARD-GENERIC-FUNCTION)

SETFGENERIC-FUNCTION-METHOD-CLASS (NEW-VALUE STANDARD-GENERIC-FUNCTION)

GENERIC-FUNCTION-METHOD-COMBINATION (STANDARD-GENERIC-FUNCTION)

SETFGENERIC-FUNCTION-METHOD-COMBINATION (NEW-VALUE STANDARD-GENERIC-FUNCTION)

GENERIC-FUNCTION-METHODS (STANDARD-GENERIC-FUNCTION)

SETFGENERIC-FUNCTION-METHODS (NEW-VALUE STANDARD-GENERIC-FUNCTION)

GENERIC-FUNCTION-NAME (STANDARD-GENERIC-FUNCTION)

METHOD-GENERIC-FUNCTION (STANDARD-METHOD)

SETFMETHOD-GENERIC-FUNCTION (NEW-VALUE STANDARD-METHOD)

METHOD-SPECIALIZERS (M)

VARIABLE

Public

*DEBUGGING-FINALIZATION*

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

- (NUMBER &REST MORE-NUMBERS)

the form currently being evaluated

CLASS

Public

Undocumented

CLASS