User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cl:functions:ensure-generic-function [2019/07/14 17:00]
cl:functions:ensure-generic-function [2019/07/18 14:00] (current)
Line 1: Line 1:
 +====== Function ENSURE-GENERIC-FUNCTION ======
 +
 +====Syntax====
 +  * **ensure-generic-function** //​function-name ''&​key''​ argument-precedence-order declare documentation environment generic-function-class lambda-list method-class method-combination//​ → //​generic-function//​
 +
 +====Arguments and Values====
 +  * //​function-name//​ - a //​[[CL:​Glossary:​function name]]//.
 +    * The keyword arguments correspond to the //option// arguments of **[[CL:​Macros:​defgeneric]]**,​ except that the **'':​method-class''​** and **'':​generic-function-class''​** arguments can be //​[[CL:​Glossary:​class]]//​ //​[[CL:​Glossary:​object|objects]]//​ as well as names.
 +    * **'':​method-combination''​** - method combination object.
 +    * **'':​environment''​** - the same as the **''&​environment''​** argument to macro expansion functions and is used to distinguish between compile-time and run-time environments.
 +  * //​generic-function//​ - a //​[[CL:​Glossary:​generic function]]//​ //​[[CL:​Glossary:​object]]//​.
 +
 +====Description====
 +The //​[[CL:​Glossary:​function]]//​ **ensure-generic-function** is used to define a globally named //​[[CL:​Glossary:​generic function]]//​ with no //​[[CL:​Glossary:​method|methods]]//​ or to specify or modify options and declarations that pertain to a globally named //​[[CL:​Glossary:​generic function]]//​ as a whole.
 +
 +If //​function-name//​ is not //​[[CL:​Glossary:​fbound]]//​ in the //​[[CL:​Glossary:​global environment]]//,​ a new //​[[CL:​Glossary:​generic function]]//​ is created.
 +
 +If ''​(fdefinition //​function-name//​)''​ is an //​[[CL:​Glossary:​ordinary function]]//,​ a //​[[CL:​Glossary:​macro]]//,​ or a //​[[CL:​Glossary:​special operator]]//,​ an error is signaled.
 +
 +If //​function-name//​ is a //​[[CL:​Glossary:​list]]//,​ it must be of the form ''​([[CL:​Macros:​setf]] //​symbol//​)''​. If //​function-name//​ specifies a //​[[CL:​Glossary:​generic function]]//​ that has a different value for any of the following arguments, the //​[[CL:​Glossary:​generic function]]//​ is modified to have the new value: **'':​argument-precedence-order''​**,​ **'':​declare''​**,​ **'':​documentation''​**,​ **'':​method-combination''​**.
 +
 +If //​function-name//​ specifies a //​[[CL:​Glossary:​generic function]]//​ that has a different value for the **'':​lambda-list''​** argument, and the new value is congruent with the //​[[CL:​Glossary:​lambda lists]]// of all existing //​[[CL:​Glossary:​method|methods]]//​ or there are no //​[[CL:​Glossary:​method|methods]]//,​ the value is changed; otherwise an error is signaled.
 +
 +If //​function-name//​ specifies a //​[[CL:​Glossary:​generic function]]//​ that has a different value for the **'':​generic-function-class''​** argument and if the new generic function class is compatible with the old, **[[CL:​Functions:​change-class]]** is called to change the //​[[CL:​Glossary:​class]]//​ of the //​[[CL:​Glossary:​generic function]]//;​ otherwise an error is signaled.
 +
 +If //​function-name//​ specifies a //​[[CL:​Glossary:​generic function]]//​ that has a different value for the **'':​method-class''​** argument, the value is changed, but any existing //​[[CL:​Glossary:​method|methods]]//​ are not changed.
 +
 +====Examples====
 +None.
 +
 +====Affected By====
 +Existing function binding of //​function-name//​.
 +
 +====Exceptional Situations====
 +If ''​(fdefinition //​function-name//​)''​ is an //​[[CL:​Glossary:​ordinary function]]//,​ a //​[[CL:​Glossary:​macro]]//,​ or a //​[[CL:​Glossary:​special operator]]//,​ an error of type **[[CL:​Types:​error]]** is signaled.
 +
 +If //​function-name//​ specifies a //​[[CL:​Glossary:​generic function]]//​ that has a different value for the **'':​lambda-list''​** argument, and the new value is not congruent with the //​[[CL:​Glossary:​lambda list]]// of any existing //​[[CL:​Glossary:​method]]//,​ an error of type **[[CL:​Types:​error]]** is signaled.
 +
 +If //​function-name//​ specifies a //​[[CL:​Glossary:​generic function]]//​ that has a different value for the **'':​generic-function-class''​** argument and if the new generic function class not is compatible with the old, an error of type **[[CL:​Types:​error]]** is signaled.
 +
 +====See Also====
 +  * **[[CL:​Macros:​defgeneric|Macro DEFGENERIC]]**
 +
 +====Notes====
 +None.
 +
 +\issue{FUNCTION-NAME:​LARGE} \issue{FUNCTION-NAME:​LARGE}