Skip to main content

allocate-instance

Generic Function ALLOCATE-INSTANCE

Syntax:

allocate-instance class &rest initargs => instance

Arguments and values:

class -- A class metaobject.

initargs -- A list of alternating initialization argument names and values.

instance -- A newly allocated instance of class.

Description:

This generic function is called to create a new, uninitialized instance of a class. The interpretation of the concept of an ``uninitialized'' instance depends on the class metaobject class.

Before allocating the new instance,class-finalized-p is called to see if class has been finalized. If it has not been finalized, finalize-inheritance is called before the new instance is allocated.

Methods:


allocate-instance (class standard-class) &rest initargs allocate-instance (class funcallable-standard-class) &rest initargs allocate-instance (class built-in-class) &rest initargs

Comments and remarks:

See also the description of this function in the Common Lisp HyperSpec.

The description above suggests that allocate-instance checks to see whether the class is finalized and if not, calls finalize-inheritance. However, the initargs passed to allocate-instance should be the defaulted initargs, and computing those initargs requires the class to be finalized. Therefore, finalize-inheritance must be called before allocate-instance is called. Peeking at PCL source confirms that finalize-inheritance is called from make-instance before allocate-instance is called.