The context-lite Reference Manual

This is the context-lite Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Jan 15 05:50:39 2023 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 context-lite

A CLOS extension to support specializing methods on special/dynamic variables.

Author

Mark Polyakov

License

MIT

Version

0.1.0

Dependency

closer-mop (system).

Source

context-lite.asd.

Child Component

context-lite.lisp (file).


3 Files

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


3.1 Lisp


3.1.1 context-lite/context-lite.asd

Source

context-lite.asd.

Parent Component

context-lite (system).

ASDF Systems

context-lite.


3.1.2 context-lite/context-lite.lisp

Source

context-lite.asd.

Parent Component

context-lite (system).

Packages

context-lite.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 context-lite

Source

context-lite.lisp.

Nickname

clite

Use List

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 Macros

Macro: defgeneric* (name lambda-list &rest options)

Create or modify a Context Lite generic*-function. Methods defined on a generic* function can specialize on both explicit arguments and the value of special/dynamic variables at call time, enabling context-based programming.

One method* may specialize on a different set of special variables than another method*. That being said, the generic* function does internally store a list of all special variables that are used in any method*, and the order of this list is important – it determines which method*s take precedence over others when multiple method*s are applicable. This "special variable precedence order" can be controlled by providing the :special-variable-precedence-order option to defgeneric*. When this option is specified, the internal list of special variables will be reordered so that the given special variables appear in the given order. You need not mention every special variable used by method*s of the generic* function in :special-variable-precedence-order, but beware that in this case defgeneric* may be forced to change the relative precedence order between the provided special variables and other special variables.

The normal lambda-list precedence is controlled in the same way as for standard generic functions. When multiple method*s that specialize on both their normal arguments and on special variables are applicable, the normal arguments always take precedence.

If not given explicitly, the special variable precedence order is determined like so: Whenever a method* is added, any special variables given in the method*’s special variable lambda list which were not used in any previous method* (or previously provided to :special-variable-precedence-order) are added to the end of the special variable precedence order, in the order given in the special variable lambda list.

See also: defmethod*

Package

context-lite.

Source

context-lite.lisp.

Macro: defmethod* (name &rest args)

Define or redefine a Context Lite method*. A method* can specialize on both its explicit arguments, and the value of special/dynamic variables at call time. The syntax is much the same as for the standard defmethod, except that a (possibly empty) "special variable lambda list" must be provided immediately after the normal lambda list. The special variable lambda list shall have names of special variables in the place of argument names, and each argument can have class or eql specializers, all with the usual syntax. A method is considered applicable when the explicit arguments match the specializers in the normal lambda list, and when each special variable mentioned in the special variable lambda list matches its specializer. No &optional, &key, etc options are allowed in the special variable lambda list.

Much of the power of Context Lite stems from the fact that the method*s defined on a generic* function may specialize on different sets of special variables. I.e., the special variable lambda list for a method* may include special variables that are not mentioned in the special variable lambda list of any other method* on the same generic* function.

Example:

(defvar *day-of-week* nil)

(defmethod* motd () ()
"It’s boring today.")
(defmethod* motd () ((*day-of-week* (eql ’monday))
"It’s Monday!!!")

(let ((*day-of-week* ’monday))
(motd) ; => "It’s Monday!!!"
)

See the documentation for defgeneric* to learn how precedence order works.

Package

context-lite.

Source

context-lite.lisp.


5.1.2 Ordinary functions

Function: ensure-generic*-function (fn-name &rest initargs)
Package

context-lite.

Source

context-lite.lisp.


5.1.3 Standalone methods

Method: initialize-instance :after ((gf generic*-function) &key name)
Source

context-lite.lisp.


5.2 Internals


5.2.1 Ordinary functions

Function: combine-special-variable-precedence-ordered (old-order new-order)
Package

context-lite.

Source

context-lite.lisp.

Function: combine-special-variable-precedence-unordered (old-order new-vars)
Package

context-lite.

Source

context-lite.lisp.

Function: lambda-list-required-arguments (lambda-list)

Given a full lambda list, with specializers, return a list of the required arguments.

Package

context-lite.

Source

context-lite.lisp.

Function: remove-from-plist (plist &rest keys)

Returns a propery-list with same keys and values as PLIST, except that keys in the list designated by KEYS and values corresponding to them are removed. The returned property-list may share structure with the PLIST, but PLIST is not destructively modified. Keys are compared using EQ.

Package

context-lite.

Source

context-lite.lisp.


5.2.2 Generic functions

Generic Function: add-all-wrapper-methods (gf)
Package

context-lite.

Methods
Method: add-all-wrapper-methods ((gf generic*-function))
Source

context-lite.lisp.

Generic Function: add-method* (gf method)
Package

context-lite.

Methods
Method: add-method* ((gf generic*-function) (method method*))
Source

context-lite.lisp.

Generic Function: ensure-generic*-function-using-class (gf fn-name &rest options &key argument-precedence-order special-variable-precedence-order special-variables lambda-list generic-function-class method-class documentation &allow-other-keys)
Package

context-lite.

Methods
Method: ensure-generic*-function-using-class ((gf generic*-function) fn-name &rest options &key argument-precedence-order special-variable-precedence-order special-variables lambda-list generic-function-class method-class documentation &allow-other-keys)
Source

context-lite.lisp.

Generic Reader: generic*-gf (object)
Package

context-lite.

Methods
Reader Method: generic*-gf ((generic*-function generic*-function))

automatically generated reader method

Source

context-lite.lisp.

Target Slot

inner-gf.

Generic Writer: (setf generic*-gf) (object)
Package

context-lite.

Methods
Writer Method: (setf generic*-gf) ((generic*-function generic*-function))

automatically generated writer method

Source

context-lite.lisp.

Target Slot

inner-gf.

Generic Reader: generic*-inner-methods (object)
Package

context-lite.

Methods
Reader Method: generic*-inner-methods ((generic*-function generic*-function))

automatically generated reader method

Source

context-lite.lisp.

Target Slot

inner-methods.

Generic Writer: (setf generic*-inner-methods) (object)
Package

context-lite.

Methods
Writer Method: (setf generic*-inner-methods) ((generic*-function generic*-function))

automatically generated writer method

Source

context-lite.lisp.

Target Slot

inner-methods.

Generic Function: generic*-inner-precedence-order (gf)
Package

context-lite.

Methods
Method: generic*-inner-precedence-order ((gf generic*-function))
Source

context-lite.lisp.

Generic Function: generic*-install-discriminating-function (gf)
Package

context-lite.

Methods
Method: generic*-install-discriminating-function ((gf generic*-function))
Source

context-lite.lisp.

Generic Reader: generic*-name (object)
Package

context-lite.

Methods
Reader Method: generic*-name ((generic*-function generic*-function))

automatically generated reader method

Source

context-lite.lisp.

Target Slot

name.

Generic Writer: (setf generic*-name) (object)
Package

context-lite.

Methods
Writer Method: (setf generic*-name) ((generic*-function generic*-function))

automatically generated writer method

Source

context-lite.lisp.

Target Slot

name.

Generic Reader: generic*-normal-argument-precedence-order (object)
Package

context-lite.

Methods
Reader Method: generic*-normal-argument-precedence-order ((generic*-function generic*-function))

automatically generated reader method

Source

context-lite.lisp.

Target Slot

normal-argument-precedence-order.

Generic Writer: (setf generic*-normal-argument-precedence-order) (object)
Package

context-lite.

Methods
Writer Method: (setf generic*-normal-argument-precedence-order) ((generic*-function generic*-function))

automatically generated writer method

Source

context-lite.lisp.

Target Slot

normal-argument-precedence-order.

Generic Reader: generic*-normal-lambda-list (object)
Package

context-lite.

Methods
Reader Method: generic*-normal-lambda-list ((generic*-function generic*-function))

automatically generated reader method

Source

context-lite.lisp.

Target Slot

normal-lambda-list.

Generic Writer: (setf generic*-normal-lambda-list) (object)
Package

context-lite.

Methods
Writer Method: (setf generic*-normal-lambda-list) ((generic*-function generic*-function))

automatically generated writer method

Source

context-lite.lisp.

Target Slot

normal-lambda-list.

Generic Reader: generic*-special-variable-precedence-order (object)
Package

context-lite.

Methods
Reader Method: generic*-special-variable-precedence-order ((generic*-function generic*-function))

automatically generated reader method

Source

context-lite.lisp.

Target Slot

special-variable-precedence-order.

Generic Writer: (setf generic*-special-variable-precedence-order) (object)
Package

context-lite.

Methods
Writer Method: (setf generic*-special-variable-precedence-order) ((generic*-function generic*-function))

automatically generated writer method

Source

context-lite.lisp.

Target Slot

special-variable-precedence-order.

Generic Reader: generic*-wrapper-method-table (object)
Package

context-lite.

Methods
Reader Method: generic*-wrapper-method-table ((generic*-function generic*-function))

automatically generated reader method

Source

context-lite.lisp.

Target Slot

wrapper-method-table.

Generic Writer: (setf generic*-wrapper-method-table) (object)
Package

context-lite.

Methods
Writer Method: (setf generic*-wrapper-method-table) ((generic*-function generic*-function))

automatically generated writer method

Source

context-lite.lisp.

Target Slot

wrapper-method-table.

Generic Reader: method*-special-variables (object)
Generic Writer: (setf method*-special-variables) (object)
Package

context-lite.

Methods
Reader Method: method*-special-variables ((method* method*))
Writer Method: (setf method*-special-variables) ((method* method*))

The special lambda list, each element (*special-variable-name* . specializer),
where specializer is either a class metaobject or an eql-specializer (just like a normal method specializer)

Source

context-lite.lisp.

Target Slot

special-variables.

Generic Function: remove-all-wrapper-methods (gf)
Package

context-lite.

Methods
Method: remove-all-wrapper-methods ((gf generic*-function))
Source

context-lite.lisp.

Generic Function: wrap-method-function (gf method num-special-vars)
Package

context-lite.

Methods
Method: wrap-method-function ((gf generic*-function) (method method*) num-special-vars)
Source

context-lite.lisp.

Generic Function: wrapper-method-specializers (gf method)
Package

context-lite.

Methods
Method: wrapper-method-specializers ((gf generic*-function) (method method*))

Given a method* and a gf that already has at least all the special variables required by the method*, generate the full specializers list for the wrapper method.

Source

context-lite.lisp.


5.2.3 Classes

Class: generic*-function
Package

context-lite.

Source

context-lite.lisp.

Direct superclasses

funcallable-standard-object.

Direct methods
Direct slots
Slot: name
Initform

(error "generic* functions need a :name")

Initargs

:name

Readers

generic*-name.

Writers

(setf generic*-name).

Slot: normal-lambda-list
Readers

generic*-normal-lambda-list.

Writers

(setf generic*-normal-lambda-list).

Slot: normal-argument-precedence-order
Readers

generic*-normal-argument-precedence-order.

Writers

(setf generic*-normal-argument-precedence-order).

Slot: special-variable-precedence-order
Readers

generic*-special-variable-precedence-order.

Writers

(setf generic*-special-variable-precedence-order).

Slot: inner-methods
Readers

generic*-inner-methods.

Writers

(setf generic*-inner-methods).

Slot: inner-gf
Readers

generic*-gf.

Writers

(setf generic*-gf).

Slot: wrapper-method-table
Initform

(make-hash-table)

Readers

generic*-wrapper-method-table.

Writers

(setf generic*-wrapper-method-table).

Class: method*
Package

context-lite.

Source

context-lite.lisp.

Direct superclasses

standard-method.

Direct methods
Direct slots
Slot: special-variables

The special lambda list, each element (*special-variable-name* . specializer),
where specializer is either a class metaobject or an eql-specializer (just like a normal method specializer)

Initargs

:special-variables

Readers

method*-special-variables.

Writers

(setf method*-special-variables).


Appendix A Indexes


A.1 Concepts


A.2 Functions

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

(
(setf generic*-gf): Private generic functions
(setf generic*-gf): Private generic functions
(setf generic*-inner-methods): Private generic functions
(setf generic*-inner-methods): Private generic functions
(setf generic*-name): Private generic functions
(setf generic*-name): Private generic functions
(setf generic*-normal-argument-precedence-order): Private generic functions
(setf generic*-normal-argument-precedence-order): Private generic functions
(setf generic*-normal-lambda-list): Private generic functions
(setf generic*-normal-lambda-list): Private generic functions
(setf generic*-special-variable-precedence-order): Private generic functions
(setf generic*-special-variable-precedence-order): Private generic functions
(setf generic*-wrapper-method-table): Private generic functions
(setf generic*-wrapper-method-table): Private generic functions
(setf method*-special-variables): Private generic functions
(setf method*-special-variables): Private generic functions

A
add-all-wrapper-methods: Private generic functions
add-all-wrapper-methods: Private generic functions
add-method*: Private generic functions
add-method*: Private generic functions

C
combine-special-variable-precedence-ordered: Private ordinary functions
combine-special-variable-precedence-unordered: Private ordinary functions

D
defgeneric*: Public macros
defmethod*: Public macros

E
ensure-generic*-function: Public ordinary functions
ensure-generic*-function-using-class: Private generic functions
ensure-generic*-function-using-class: Private generic functions

F
Function, combine-special-variable-precedence-ordered: Private ordinary functions
Function, combine-special-variable-precedence-unordered: Private ordinary functions
Function, ensure-generic*-function: Public ordinary functions
Function, lambda-list-required-arguments: Private ordinary functions
Function, remove-from-plist: Private ordinary functions

G
Generic Function, (setf generic*-gf): Private generic functions
Generic Function, (setf generic*-inner-methods): Private generic functions
Generic Function, (setf generic*-name): Private generic functions
Generic Function, (setf generic*-normal-argument-precedence-order): Private generic functions
Generic Function, (setf generic*-normal-lambda-list): Private generic functions
Generic Function, (setf generic*-special-variable-precedence-order): Private generic functions
Generic Function, (setf generic*-wrapper-method-table): Private generic functions
Generic Function, (setf method*-special-variables): Private generic functions
Generic Function, add-all-wrapper-methods: Private generic functions
Generic Function, add-method*: Private generic functions
Generic Function, ensure-generic*-function-using-class: Private generic functions
Generic Function, generic*-gf: Private generic functions
Generic Function, generic*-inner-methods: Private generic functions
Generic Function, generic*-inner-precedence-order: Private generic functions
Generic Function, generic*-install-discriminating-function: Private generic functions
Generic Function, generic*-name: Private generic functions
Generic Function, generic*-normal-argument-precedence-order: Private generic functions
Generic Function, generic*-normal-lambda-list: Private generic functions
Generic Function, generic*-special-variable-precedence-order: Private generic functions
Generic Function, generic*-wrapper-method-table: Private generic functions
Generic Function, method*-special-variables: Private generic functions
Generic Function, remove-all-wrapper-methods: Private generic functions
Generic Function, wrap-method-function: Private generic functions
Generic Function, wrapper-method-specializers: Private generic functions
generic*-gf: Private generic functions
generic*-gf: Private generic functions
generic*-inner-methods: Private generic functions
generic*-inner-methods: Private generic functions
generic*-inner-precedence-order: Private generic functions
generic*-inner-precedence-order: Private generic functions
generic*-install-discriminating-function: Private generic functions
generic*-install-discriminating-function: Private generic functions
generic*-name: Private generic functions
generic*-name: Private generic functions
generic*-normal-argument-precedence-order: Private generic functions
generic*-normal-argument-precedence-order: Private generic functions
generic*-normal-lambda-list: Private generic functions
generic*-normal-lambda-list: Private generic functions
generic*-special-variable-precedence-order: Private generic functions
generic*-special-variable-precedence-order: Private generic functions
generic*-wrapper-method-table: Private generic functions
generic*-wrapper-method-table: Private generic functions

I
initialize-instance: Public standalone methods

L
lambda-list-required-arguments: Private ordinary functions

M
Macro, defgeneric*: Public macros
Macro, defmethod*: Public macros
method*-special-variables: Private generic functions
method*-special-variables: Private generic functions
Method, (setf generic*-gf): Private generic functions
Method, (setf generic*-inner-methods): Private generic functions
Method, (setf generic*-name): Private generic functions
Method, (setf generic*-normal-argument-precedence-order): Private generic functions
Method, (setf generic*-normal-lambda-list): Private generic functions
Method, (setf generic*-special-variable-precedence-order): Private generic functions
Method, (setf generic*-wrapper-method-table): Private generic functions
Method, (setf method*-special-variables): Private generic functions
Method, add-all-wrapper-methods: Private generic functions
Method, add-method*: Private generic functions
Method, ensure-generic*-function-using-class: Private generic functions
Method, generic*-gf: Private generic functions
Method, generic*-inner-methods: Private generic functions
Method, generic*-inner-precedence-order: Private generic functions
Method, generic*-install-discriminating-function: Private generic functions
Method, generic*-name: Private generic functions
Method, generic*-normal-argument-precedence-order: Private generic functions
Method, generic*-normal-lambda-list: Private generic functions
Method, generic*-special-variable-precedence-order: Private generic functions
Method, generic*-wrapper-method-table: Private generic functions
Method, initialize-instance: Public standalone methods
Method, method*-special-variables: Private generic functions
Method, remove-all-wrapper-methods: Private generic functions
Method, wrap-method-function: Private generic functions
Method, wrapper-method-specializers: Private generic functions

R
remove-all-wrapper-methods: Private generic functions
remove-all-wrapper-methods: Private generic functions
remove-from-plist: Private ordinary functions

W
wrap-method-function: Private generic functions
wrap-method-function: Private generic functions
wrapper-method-specializers: Private generic functions
wrapper-method-specializers: Private generic functions