Instance Management



instantiate class &optional size [function]

the lowest primitive to create a new object from a class. If the class is a vector-class, size should be supplied.


instance class &rest message [macro]

An instance is created, and the message is sent to it.


make-instance class &rest var-val-pairs [function]

creates an instance of class and sets its slot variables according to var-val-pairs. For example, (make-instance cons :car 1 :cdr 2) is equivalent to (cons 1 2).


copy-object object [function]

copy-object function is used to copy objects keeping the referencing topologies even they have recursive references. Copy-object copies any objects accessible from object except symbols and packages, which are untouched to keep the uniqueness of symbols. copy-object traverses all the references in an object twice: once to create new objects and to mark original objects that they have already copied, and again to remove marks. This two-step process makes copy-object work slower than copy-seq. If what you wish to copy is definitely a sequence, use of copy-seq or copy-tree is recommended.


become object class [function]

changes the class of object to class. The slot structure of both the old class and the new class must be consistent. Usually, this can be safely used only for changing class between binary vectors, for example from an integer-vector to a bit-vector.


replace-object dest src [function]

dest must be an instance of the subclass of src.


class object [function]

returns the class object of object. To get the name of the class, send :name message to the class object.


derivedp object class [function]

derivedp checks if an object is instantiated from class or class's subclasses. subclassp and derivedp functions do not search in class hierarchy: type check always finishes within a constant time.


slot object class (index $\vert$ slot-name) [function]

Returns the named or indexed slot value.


setslot object class (index $\vert$ slot-name) value [function]

Setslot is a internal function and users should not use it. Use, instead, combination of setf and slot.


k-okada 2013-05-21