informaticsEn 2022-07-19 11:25:47

Common lisp make-instance

When you call  make-instance, Lisp (CLOS) performs the following steps.

  • Combines the initargs you supply to make-instance with the default values for any initargs you do not explicitly supply. The result is a defaulted initargs list.
  • Ensures that all initargs names in the default initarg list are valid, and signal an error if they are not. If :allow-other-keys is provided as true in the call to make-instance, all initarg names are valid
  • Allocates storage for the instance and creates  an instance whose slots are all unbound.

  • Applies the initialize-instance generic function to the newly created instance and the defaulted initarg list. The default primary method for initialize-instance does the following.

                   -    Initializes slots according to the defaulted initarg list

                   -   Initializes any slots that have :initforma and are still unbound.

  • Returns the initialized instance

You can see the CLOS elements:

Common Lisp Object System


Back to index

También te podría interesar
informaticsEn 2022-07-13 10:20:31
informaticsEn 2022-08-01 14:11:38
informaticsEn 2022-07-19 11:24:12
The fundamental elements of CLOS programs in Common Lisp
informaticsEn 2022-07-19 11:25:00
informaticsEn 2022-07-19 11:26:24
A brief guide to Common Lisp Object System (CLOS) What is a slot?