]> git.decadent.org.uk Git - ion3-doc.git/blob - objectsimpl.tex
[svn-upgrade] Integrating new upstream version, ion3-doc (20080103)
[ion3-doc.git] / objectsimpl.tex
1 \section{Object system implementation}
2
3 First, to get things clear, what are considered objects here are C
4 structures containing a properly initialised \type\indextype{WObj}
5 structure defined in \file{ioncore/obj.h} as the first element (or the
6 first element of the structure which is the first element and so on which
7 gives rise to inheritance). The \type{WObj} structure contains a pointer
8 to a \type{WObjDescr}\indextype{WObjDescr} class type info structure and
9 a list of so called ``watches''. The \type{WObjDescr} structure simply
10 lists the class name, a table of dynamic functions and a pointer to
11 deinitialisation function (or ``destructor'').
12
13 Ion does not do any reference counting, garbage collecting or other
14 fancy things related to automatic safe freeing of objects with its
15 simplistic object system. Instead special watches (the \type{WWatch}
16 \indextype{WWatch} structure) may be used to create safe references to
17 objects that might be destroyed during the time the specific pointer is
18 needed. When an object is destroyed, its list of watches is processed,
19 setting the pointers in the watches to NULL and the watch handlers for
20 each watch are called.