4 <p>Vala supports four kinds of data types: value types, reference types, type parameters, and pointer types. Value types include simple types (e.g. char, int, and float), enum types, array types, and struct types. Reference types include object types, delegate types, and error types. Type parameters are parameters used in generic types.</p>
5 <p>Value types differ from reference types in that variables of the value types directly contain their data, whereas variables of the reference types store references to their data, the latter being known as objects. With reference types, it is possible for two variables to reference the same object, and thus possible for operations on one variable to affect the object referenced by the other variable. With value types, the variables each have their own copy of the data, and it is not possible for operations on one to affect the other.</p>
14 <section id="valuetypes">
16 <p>Instances of value types are stored directly in variables. They are duplicated whenever assigned to another variable (e.g. passed to a method). For local variables, value types are stored on the stack.</p>
58 non-array-type <l>[]</l>
59 non-array-type <l>[</l> dim-seperators <l>]</l>
70 dim-separators <l>,</l>
72 <section id="structtypes">
76 <section id="simpletypes">
80 <section id="integraltypes">
84 <section id="floatingpointtypes">
85 <h>Floating point types</h>
88 <section id="booltype">
92 <section id="enumtypes">
93 <h>Enumeration types</h>
94 <p>An enumeration type is a type containing named constants.</p>
98 <section id="referencetypes">
99 <h>Reference types</h>
100 <p>Instances of reference types are always stored on the heap. Variables contain references to them. Assigning to another variable duplicates reference, not object.</p>
110 <l>weak</l> object-type
111 <l>weak</l> class-type
112 <l>weak</l> array-type
113 <l>weak</l> delegate-type
114 <l>weak</l> error-type
121 type-name <l>. Class</l>
129 <section id="weakreferencetypes">
130 <h>Weak reference types</h>
133 <section id="arraytypes">
135 <p>An array is a data structure that contains zero or more elements of the same type.</p>
137 <section id="delegatetypes">
138 <h>Delegate types</h>
139 <p>A delegate is a data structure that refers to a method, and for instance methods, it also refers to the corresponding object instance.</p>
141 <section id="errortypes">
143 <p>Instances of error types represent recoverable runtime errors.</p>
146 <section id="nullabletypes">
147 <h>Nullable types</h>
148 <p>An instance of a nullable type <code>T?</code> can either be a value of type <code>T</code> or <code>null</code>.</p>
152 reference-type <l>?</l>
155 <section id="pointertypes">
157 <p>Unlike references, pointers are not tracked by the memory manager. The value of a pointer having type T* represents the address of a variable of type T. The pointer indirection operator * can be used to access this variable. Like a nullable object reference, a pointer can be null. The <code>void*</code> type represents a pointer to an unknown type. As the referent type is unknown, the indirection operator cannot be applied to a pointer of type <code>void*</code>, nor can any arithmetic be performed on such a pointer. However, a pointer of type <code>void*</code> can be cast to any other pointer type (and vice versa) and compared to values of other pointer types.</p>
161 pointer-type <l>*</l>