Package: closer-mop

Function ensure-generic-function

Lambda List

ensure-generic-function (fun-name &rest all-keys &key environment definition-source &allow-other-keys)

Arguments

The function-name argument is a symbol or a list of the form (setf symbol).
Some of the keyword arguments accepted by this function are actually processed by ensure-generic-function-using-class, others are processed during initialization of the generic function metaobject (as described in the section called "Initialization of Generic Function Metaobjects").

Return Value

The result is a generic function metaobject.

Details

This function is called to define a globally named generic function or to specify or modify options and declarations that pertain to a globally named generic function as a whole. It can be called by the user or the implementation.

It is the functional equivalent of defgeneric, and is called by the expansion of the defgeneric and defmethod macros.

The behavior of this function is actually implemented by the generic function ensure-generic-function-using-class. When ensure-generic-function is called, it immediately calls ensure-generic-function-using-class and returns that result as its own.

The first argument to ensure-generic-function-using-class is computed as follows:
  • If function-name names a non-generic function, a macro, or a special form, an error is signaled.
  • If function-name names a generic function, that generic function metaobject is used.
  • Otherwise, nil is used.
The second argument is function-name. The remaining arguments are the complete set of keyword arguments received by ensure-generic-function.