User Tools


Differences

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

Link to this comparison view

cl:macros:call-method [2019/07/14 17:00]
cl:macros:call-method [2019/07/20 08:00] (current)
Line 1: Line 1:
 +====== Local Macro CALL-METHOD,​ MAKE-METHOD ======
 +
 +====Syntax====
 +  * **call-method** //method ''&​optional''​ next-method-list//​ → //​result''​*''//​
 +  * **make-method** //form// → //​method-object//​
 +
 +====Arguments and Values====
 +  * //method// - a //​[[CL:​Glossary:​method]]//​ //​[[CL:​Glossary:​object]]//,​ or a //​[[CL:​Glossary:​list]]//​ (see below); not evaluated.
 +  * //​method-object//​ - a //​[[CL:​Glossary:​method]]//​ //​[[CL:​Glossary:​object]]//​.
 +  * //​next-method-list//​ - a //​[[CL:​Glossary:​list]]//​ of //method// //​[[CL:​Glossary:​object|objects]]//;​ not evaluated.
 +  * //results// - the //​[[CL:​Glossary:​values]]//​ returned by the //​[[CL:​Glossary:​method]]//​ invocation.
 +
 +====Description====
 +The macro **call-method** is used in method combination. It hides the //​[[CL:​Glossary:​implementation-dependent]]//​ details of how //​[[CL:​Glossary:​method|methods]]//​ are called. The macro **call-method** has //​[[CL:​Glossary:​lexical scope]]// and can only be used within an //​[[CL:​Glossary:​effective method]]// //​[[CL:​Glossary:​form]]//​.
 +
 +\editornote{KMP:​ This next paragraph still needs some work.}
 +
 +Whether or not **call-method** is //​[[CL:​Glossary:​fbound]]//​ in the //​[[CL:​Glossary:​global environment]]//​ is //​[[CL:​Glossary:​implementation-dependent]]//;​ however, the restrictions on redefinition and //​[[CL:​Glossary:​shadowing]]//​ of **call-method** are the same as for //​[[CL:​Glossary:​symbols]]//​ in the **''​common-lisp''​** //​[[CL:​Glossary:​package]]// ​ which are //​[[CL:​Glossary:​fbound]]//​ in the //​[[CL:​Glossary:​global environment]]//​. The consequences of attempting to use **call-method** outside of an //​[[CL:​Glossary:​effective method]]// //​[[CL:​Glossary:​form]]//​ are undefined.
 +
 +The macro **call-method** invokes the specified //​[[CL:​Glossary:​method]]//,​ supplying it with arguments and with definitions for **[[CL:​Functions:​call-next-method]]** and for **[[CL:​Functions:​next-method-p]]**. If the invocation of **call-method** is lexically inside of a **make-method**,​ the arguments are those that were supplied to that method. Otherwise the arguments are those that were supplied to the generic function. The definitions of **[[CL:​Functions:​call-next-method]]** and **[[CL:​Functions:​next-method-p]]** rely on the specified //​next-method-list//​.
 +
 +If //method// is a //​[[CL:​Glossary:​list]]//,​ the first element of the //​[[CL:​Glossary:​list]]//​ must be the symbol **make-method** and the second element must be a //​[[CL:​Glossary:​form]]//​. Such a //​[[CL:​Glossary:​list]]//​ specifies a //​[[CL:​Glossary:​method]]//​ //​[[CL:​Glossary:​object]]//​ whose //​[[CL:​Glossary:​method]]//​ function has a body that is the given //​[[CL:​Glossary:​form]]//​.
 +
 +//​next-method-list//​ can contain //​[[CL:​Glossary:​method]]//​ //​[[CL:​Glossary:​object|objects]]//​ or //​[[CL:​Glossary:​lists]]//,​ the first element of which must be the symbol **make-method** and the second element of which must be a //​[[CL:​Glossary:​form]]//​.
 +
 +Those are the only two places where **make-method** can be used. The //​[[CL:​Glossary:​form]]//​ used with **make-method** is evaluated in the //​[[CL:​Glossary:​null lexical environment]]//​ augmented with a local macro definition for **call-method** and with bindings named by symbols not //​[[CL:​Glossary:​accessible]]//​ from the **''​common-lisp-user''​** //​[[CL:​Glossary:​package]]//​ .
 +
 +The **[[CL:​Functions:​call-next-method]]** function available to //method// will call the first //​[[CL:​Glossary:​method]]//​ in //​next-method-list//​. The **[[CL:​Functions:​call-next-method]]** function available in that //​[[CL:​Glossary:​method]]//,​ in turn, will call the second //​[[CL:​Glossary:​method]]//​ in //​next-method-list//,​ and so on, until the list of next //​[[CL:​Glossary:​method|methods]]//​ is exhausted.
 +
 +If //​next-method-list//​ is not supplied, the **[[CL:​Functions:​call-next-method]]** function available to //method// signals an error of type **[[CL:​Types:​control-error]]** and the **[[CL:​Functions:​next-method-p]]** function available to //method// returns {**[[CL:​Constant Variables:​nil]]**}.
 +
 +====Examples====
 +None.
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +None.
 +
 +====See Also====
 +  * **[[CL:​Functions:​call-next-method|Function CALL-NEXT-METHOD]]**
 +  * **[[CL:​Macros:​define-method-combination|Macro DEFINE-METHOD-COMBINATION]]**
 +  * **[[CL:​Functions:​next-method-p|Function NEXT-METHOD-P]]**
 +
 +====Notes====
 +None.
 +
 +\issue{LEXICAL-CONSTRUCT-GLOBAL-DEFINITION:​UNDEFINED}