User Tools


Differences

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

Link to this comparison view

cl:functions:allocate-instance [2019/07/14 17:00]
cl:functions:allocate-instance [2019/07/17 21:00] (current)
Line 1: Line 1:
 +====== Standard Generic Function ALLOCATE-INSTANCE ======
 +
 +====Syntax====
 +  * **allocate-instance** //class ''&​rest''​ initargs ''&​key''​ ''&​allow-other-keys''//​ → //​new-instance//​
 +
 +====Method Signatures====
 +  * **allocate-instance** (//class// **[[CL:​Types:​standard-class]]**) //''&​rest''​ initargs//
 +  * **allocate-instance** (//class// **[[CL:​Types:​structure-class]]**) //''&​rest''​ initargs//
 +
 +====Arguments and Values====
 +  * //class// - a //​[[CL:​Glossary:​class]]//​.
 +  * //​initargs//​ - a //​[[CL:​Glossary:​list]]//​ of //​[[CL:​Glossary:​keyword/​value pair|keyword/​value pairs]]// (initialization argument //​[[CL:​Glossary:​name|names]]//​ and //​[[CL:​Glossary:​value|values]]//​).
 +  * //​new-instance//​ - an //​[[CL:​Glossary:​object]]//​ whose //​[[CL:​Glossary:​class]]//​ is //class//.
 +
 +====Description====
 +The generic function **allocate-instance** creates and returns a new instance of the //class//, without initializing it. When the //class// is a //​[[CL:​Glossary:​standard class]]//, this means that the //​[[CL:​Glossary:​slot|slots]]//​ are //​[[CL:​Glossary:​unbound]]//;​ when the //​[[CL:​Glossary:​class]]//​ is a //​[[CL:​Glossary:​structure class]]//, this means the //​[[CL:​Glossary:​slot|slots]]//'​ //​[[CL:​Glossary:​values]]//​ are unspecified.
 +
 +The caller of **allocate-instance** is expected to have already checked the initialization arguments.
 +
 +The //​[[CL:​Glossary:​generic function]]//​ **allocate-instance** is called by **[[CL:​Functions:​make-instance]]**,​ as described in \secref\ObjectCreationAndInit.
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +None.
 +
 +====See Also====
 +  * **[[CL:​Macros:​defclass|Macro DEFCLASS]]**
 +  * **[[CL:​Functions:​make-instance|Generic Function MAKE-INSTANCE]]**
 +  * **[[CL:​Functions:​class-of|Function CLASS-OF]]**
 +  * {\secref\ObjectCreationAndInit}
 +
 +====Notes====
 +The consequences of adding //​[[CL:​Glossary:​method|methods]]//​ to **allocate-instance** is unspecified. This capability might be added by the //​[[CL:​Glossary:​Metaobject Protocol]]//​.
 +
 +\issue{ALLOCATE-INSTANCE:​ADD} \issue{INITIALIZATION-FUNCTION-KEYWORD-CHECKING}