\chapter{Introduction}

% Talk about Cforall and exceptions generally.
This thesis goes over the design and implementation of the exception handling
mechanism (EHM) of
\CFA (pernounced sea-for-all, can also be written Cforall or CFA).
Exception handling provides dynamic inter-function control flow. Although
a powerful feature they tend to be expensive to use so they are often limited
to unusual or ``exceptional" cases.
The classic example of this is error handling, exceptions can be used to
remove error handling logic from the main execution path and paying most of
the cost only when the error actually occurs.

% Overview of exceptions in Cforall.
The \CFA EHM implements all of the common exception features (or an
equivalent) found in most other EHMs and adds some features of its own.
The design of all the features had to be adapted to \CFA's feature set as
some of the underlying tools used to implement and express exception handling
in other languages are absent in \CFA.
Still the resulting syntax resembles that of other languages:
\begin{cfa}
try {
	...
	T * object = malloc(request_size);
	if (!object) {
		throw OutOfMemory{fixed_allocation, request_size};
	}
	...
} catch (OutOfMemory * error) {
	...
}
\end{cfa}

% A note that yes, that was a very fast overview.
All the design and implementation of all of \CFA's EHM's features are
described in detail later in this thesis, whether they are a common feature
or one unique to \CFA.

% The current state of the project and what it contributes.
All of these features have been added to the \CFA implemenation, along with
a suite of test cases.
The implementation techniques are generally applicable in other programming
languages and much of the design is as well, although occationally
replacements for some of \CFA's more unusual feature would have to be found.
