<?xml version="1.0"?>
<section id="types">
	<h>Types</h>
	<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>
	<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>
	<blockquote>
type:
	value-type
	reference-type
	nullable-type
	type-parameter
	pointer-type
	</blockquote>
	<section id="valuetypes">
		<h>Value types</h>
		<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>
		<blockquote>
value-type:
	struct-type
	enum-type
        array-type

struct-type:
	type-name
	integral-type
	floating-point-type
	<l>bool</l>

integral-type:
	<l>char</l>
	<l>uchar</l>
	<l>short</l>
	<l>ushort</l>
	<l>int</l>
	<l>uint</l>
	<l>long</l>
	<l>ulong</l>
	<l>size_t</l>
	<l>ssize_t</l>
	<l>int8</l>
	<l>uint8</l>
	<l>int16</l>
	<l>uint16</l>
	<l>int32</l>
	<l>uint32</l>
	<l>int64</l>
	<l>uint64</l>
	<l>unichar</l>

floating-point-type:
	<l>float</l>
	<l>double</l>

enum-type:
	type-name

array-type:
	non-array-type <l>[]</l>
	non-array-type <l>[</l> dim-seperators <l>]</l>

non-array-type:
	value-type
	object-type
	class-type
	delegate-type
	error-type

dim-separators:
	<l>,</l>
	dim-separators <l>,</l>
		</blockquote>
		<section id="structtypes">
			<h>Struct types</h>
			<p>Documentation</p>
		</section>
		<section id="simpletypes">
			<h>Simple types</h>
			<p>Documentation</p>
		</section>
		<section id="integraltypes">
			<h>Integral types</h>
			<p>Documentation</p>
		</section>
		<section id="floatingpointtypes">
			<h>Floating point types</h>
			<p>Documentation</p>
		</section>
		<section id="booltype">
			<h>The bool type</h>
			<p>Documentation</p>
		</section>
		<section id="enumtypes">
			<h>Enumeration types</h>
			<p>An enumeration type is a type containing named constants.</p>
			<p>See enums.</p>
		</section>
	</section>
	<section id="referencetypes">
		<h>Reference types</h>
		<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>
		<blockquote>
reference-type:
	object-type
	class-type
	delegate-type
	error-type
	weak-reference-type

weak-reference-type:
	<l>weak</l> object-type
	<l>weak</l> class-type
	<l>weak</l> array-type
	<l>weak</l> delegate-type
	<l>weak</l> error-type

object-type:
	type-name
	<l>string</l>

class-type:
	type-name <l>. Class</l>

delegate-type:
	type-name

error-type:
	type-name
		</blockquote>
		<section id="weakreferencetypes">
			<h>Weak reference types</h>
			<p>Documentation</p>
		</section>
		<section id="arraytypes">
			<h>Array types</h>
			<p>An array is a data structure that contains zero or more elements of the same type.</p>
		</section>
		<section id="delegatetypes">
			<h>Delegate types</h>
			<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>
		</section>
		<section id="errortypes">
			<h>Error types</h>
			<p>Instances of error types represent recoverable runtime errors.</p>
		</section>
	</section>
	<section id="nullabletypes">
		<h>Nullable types</h>
		<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>
		<blockquote>
nullable-type:
	value-type <l>?</l>
	reference-type <l>?</l>
		</blockquote>
	</section>
	<section id="pointertypes">
		<h>Pointer types</h>
		<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>
		<blockquote>
pointer-type:
	type-name <l>*</l>
	pointer-type <l>*</l>
	<l>void*</l>
		</blockquote>
	</section>
</section>

