1 | \chapter{Introduction}
|
---|
2 |
|
---|
3 | % Talk about Cforall and exceptions generally.
|
---|
4 | This thesis goes over the design and implementation of the exception handling
|
---|
5 | mechanism (EHM) of
|
---|
6 | \CFA (pernounced sea-for-all, can also be written Cforall or CFA).
|
---|
7 | Exception handling provides dynamic inter-function control flow. Although
|
---|
8 | a powerful feature they tend to be expensive to use so they are often limited
|
---|
9 | to unusual or ``exceptional" cases.
|
---|
10 | The classic example of this is error handling, exceptions can be used to
|
---|
11 | remove error handling logic from the main execution path and paying most of
|
---|
12 | the cost only when the error actually occurs.
|
---|
13 |
|
---|
14 | % Overview of exceptions in Cforall.
|
---|
15 | The \CFA EHM implements all of the common exception features (or an
|
---|
16 | equivalent) found in most other EHMs and adds some features of its own.
|
---|
17 | The design of all the features had to be adapted to \CFA's feature set as
|
---|
18 | some of the underlying tools used to implement and express exception handling
|
---|
19 | in other languages are absent in \CFA.
|
---|
20 | Still the resulting syntax resembles that of other languages:
|
---|
21 | \begin{cfa}
|
---|
22 | try {
|
---|
23 | ...
|
---|
24 | T * object = malloc(request_size);
|
---|
25 | if (!object) {
|
---|
26 | throw OutOfMemory{fixed_allocation, request_size};
|
---|
27 | }
|
---|
28 | ...
|
---|
29 | } catch (OutOfMemory * error) {
|
---|
30 | ...
|
---|
31 | }
|
---|
32 | \end{cfa}
|
---|
33 |
|
---|
34 | % A note that yes, that was a very fast overview.
|
---|
35 | All the design and implementation of all of \CFA's EHM's features are
|
---|
36 | described in detail later in this thesis, whether they are a common feature
|
---|
37 | or one unique to \CFA.
|
---|
38 |
|
---|
39 | % The current state of the project and what it contributes.
|
---|
40 | All of these features have been added to the \CFA implemenation, along with
|
---|
41 | a suite of test cases.
|
---|
42 | The implementation techniques are generally applicable in other programming
|
---|
43 | languages and much of the design is as well, although occationally
|
---|
44 | replacements for some of \CFA's more unusual feature would have to be found.
|
---|