informaticsEn 2022-07-19 11:26:24
222

Slots

All the instances of a class have the same structure. That structure is in the form of slots.

A slot consists of a name and a value.

- Slot name is the characteristic.
- Slot value is the state at given time.
-The state can be read and written by accessors.


A slot definition metaobject contains information about the  definition of a slot. There are two kinds of slot definition  metaobjects. A direct slot definition metaobject is used to represent  the direct definition of a slot in a class. This corresponds roughly to  the slot specifiers found in defclass forms. An effective slot definition metaobject is used to represent  information, including inherited information, about a slot which is  accessible in instances of a particular class.


Associated with each class metaobject is a list of direct  slot definition metaobjects representing the slots defined directly in  the class. Also associated with each class metaobject is a list of  effective slot definition metaobjects representing the set of slots  accessible in instances of that class.


The following information is associated with both direct and effective slot definitions metaobjects:



  • The name, allocation, and type are available as forms that could appear in a defclass form.
  • The initialization form, if there is one, is available as a form that could appear in a defclass form. The initialization form together with its lexical environment is available as a function of no arguments which, when called, returns the result of evaluating the initialization form in its lexical environment. This is called the initfunction of the slot.
  • The slot filling initialization arguments are available as a list of symbols.
  • The documentation is available as a string or nil.


Certain other information is only associated with direct  slot definition metaobjects. This information applies only to the direct definition of the slot in the class (it is not inherited).



  • The function names of those generic functions for which there are automatically generated reader and writer methods. This information is available as lists of function names. Any accessors specified in the defclass form are broken down into their equivalent readers and writers in the direct slot definition.


References:

https://clos-mop.hexstreamsoft.com/concepts/#slot-definitions

#lisp

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:47
informaticsEn 2022-07-19 11:25:00