Index: doc/theses/andrew_beach_MMath/existing.tex
===================================================================
--- doc/theses/andrew_beach_MMath/existing.tex	(revision 21f2e92cc04ae6084c47a9c19c1144d7e62a0d16)
+++ doc/theses/andrew_beach_MMath/existing.tex	(revision 382edbe649c466cf0d3561d668e466885586b963)
@@ -1,6 +1,6 @@
-\chapter{\CFA Existing Features}
+\chapter{\CFA{} Existing Features}
 \label{c:existing}
 
-\CFA (C-for-all)~\cite{Cforall} is an open-source project extending ISO C with
+\CFA is an open-source project extending ISO C with
 modern safety and productivity features, while still ensuring backwards
 compatibility with C and its programmers.  \CFA is designed to have an
@@ -9,7 +9,7 @@
 existing C code-base allowing programmers to learn \CFA on an as-needed basis.
 
-Only those \CFA features pertinent to this thesis are discussed.  Many of the
-\CFA syntactic and semantic features used in the thesis should be fairly
-obvious to the reader.
+Only those \CFA features pertaining to this thesis are discussed.
+Also, only new features of \CFA will be discussed, a basic familiarity with
+C or C-like languages is assumed.
 
 \section{Overloading and \lstinline{extern}}
@@ -45,19 +45,15 @@
 \CFA adds a reference type to C as an auto-dereferencing pointer.
 They work very similarly to pointers.
-Reference-types are written the same way as a pointer-type is but each
+Reference-types are written the same way as a pointer-type but each
 asterisk (@*@) is replaced with a ampersand (@&@);
 this includes cv-qualifiers and multiple levels of reference.
 
-They are intended for cases where you would want to use pointers but would
-be dereferencing them (almost) every usage.
-In most cases a reference can just be thought of as a pointer that
-automatically puts a dereference infront of each of its uses (per-level of
-reference).
-The address-of operator (@&@) acts as an escape and removes one of the
-automatic dereference operations.
-Mutable references may be assigned to by converting them to a pointer
-with a @&@ and then assigning a pointer too them.
-
-\begin{minipage}{0,45\textwidth}
+Generally, references act like pointers with an implicate dereferencing
+operation added to each use of the variable.
+These automatic dereferences may be disabled with the address-of operator
+(@&@).
+
+% Check to see if these are generating errors.
+\begin{minipage}{0,5\textwidth}
 With references:
 \begin{cfa}
@@ -70,5 +66,5 @@
 \end{cfa}
 \end{minipage}
-\begin{minipage}{0,45\textwidth}
+\begin{minipage}{0,5\textwidth}
 With pointers:
 \begin{cfa}
@@ -82,20 +78,43 @@
 \end{minipage}
 
-\section{Constructors and Destructors}
-
-Both constructors and destructors are operators, which means they are
-functions with special operator names rather than type names in \Cpp. The
-special operator names may be used to call the functions explicitly (not
-allowed in \Cpp for constructors).
-
-In general, operator names in \CFA are constructed by bracketing an operator
-token with @?@, which indicates the position of the arguments. For example,
+References are intended to be used when you would use pointers but would
+be dereferencing them (almost) every usage.
+Mutable references may be assigned to by converting them to a pointer
+with a @&@ and then assigning a pointer to them, as in @&ri = &j;@ above
+
+\section{Operators}
+
+\CFA implements operator overloading by providing special names.
+Operator uses are translated into function calls using these names.
+These names are created by taking the operator symbols and joining them with
+@?@ where the arguments would go.
+For example,
 infixed multiplication is @?*?@ while prefix dereference is @*?@.
 This syntax make it easy to tell the difference between prefix operations
 (such as @++?@) and post-fix operations (@?++@).
 
+\begin{cfa}
+int ?+?(point a, point b) { return point{a.x + b.x, a.y + b.y}; }
+bool ?==?(point a, point b) { return a.x == b.x && a.y == b.y; }
+{
+	assert(point{1, 2} + point{3, 4} == point{4, 6});
+}
+\end{cfa}
+Note that these special names are not limited to just being used for these
+operator functions, and may be used name other declarations.
+Some ``near misses", that will not match an operator form but looks like
+it may have been supposed to, will generate wantings but otherwise they are
+left alone.
+
+%\subsection{Constructors and Destructors}
+
+Both constructors and destructors are operators, which means they are
+functions with special operator names rather than type names in \Cpp. The
+special operator names may be used to call the functions explicitly.
+% Placement new means that this is actually equivant to C++.
+
 The special name for a constructor is @?{}@, which comes from the
-initialization syntax in C. That initialation syntax is also the operator
-form. \CFA will generate a constructor call each time a variable is declared,
+initialization syntax in C, \eg @Example e = { ... }@.
+\CFA will generate a constructor call each time a variable is declared,
 passing the initialization arguments to the constructort.
 \begin{cfa}
@@ -111,21 +130,19 @@
 }
 \end{cfa}
-Both @a@ and @b@ will be initalized with the first constructor (there is no
-general way to skip initialation) while @c@ will be initalized with the
-second.
+Both @a@ and @b@ will be initalized with the first constructor,
+while @c@ will be initalized with the second.
+Currently, there is no general way to skip initialation.
 
 % I don't like the \^{} symbol but $^\wedge$ isn't better.
 Similarly destructors use the special name @^?{}@ (the @^@ has no special
-meaning). They can be called explicatly as well but normally they are
-implicitly called on a variable when it goes out of scope.
+meaning).
+These are a normally called implicitly called on a variable when it goes out
+of scope. They can be called explicitly as well.
 \begin{cfa}
 void ^?{}(Example & this) { ... }
 {
-    Example d;
+	Example d;
 } // <- implicit destructor call
 \end{cfa}
-No operator name is restricted in what function signatures they may be bound
-to although most of the forms cannot be called in operator form. Some
-``near-misses" will generate warnings.
 
 Whenever a type is defined, \CFA will create a default zero-argument
@@ -153,5 +170,5 @@
 char capital_a = identity( 'A' );
 \end{cfa}
-Each use of a polymorphic declaration will resolve its polymorphic parameters
+Each use of a polymorphic declaration resolves its polymorphic parameters
 (in this case, just @T@) to concrete types (@int@ in the first use and @char@
 in the second).
@@ -159,9 +176,9 @@
 To allow a polymorphic function to be separately compiled, the type @T@ must be
 constrained by the operations used on @T@ in the function body. The @forall@
-clauses is augmented with a list of polymorphic variables (local type names)
+clause is augmented with a list of polymorphic variables (local type names)
 and assertions (constraints), which represent the required operations on those
 types used in a function, \eg:
 \begin{cfa}
-forall( T | { void do_once(T); })
+forall( T | { void do_once(T); } )
 void do_twice(T value) {
 	do_once(value);
@@ -190,5 +207,5 @@
 void do_once(double y) { ... }
 int quadruple(int x) {
-	void do_once(int y) { y = y * 2; }
+	void do_once(int & y) { y = y * 2; }
 	do_twice(x);
 	return x;
@@ -200,5 +217,8 @@
 function. The matched assertion function is then passed as a function pointer
 to @do_twice@ and called within it.
-The global definition of @do_once@ is ignored.
+The global definition of @do_once@ is ignored, however if quadruple took a
+@double@ argument then the global definition would be used instead as it
+would be a better match.
+% Aaron's thesis might be a good reference here.
 
 To avoid typing long lists of assertions, constraints can be collect into
@@ -270,7 +290,8 @@
 Each coroutine has a @main@ function, which takes a reference to a coroutine
 object and returns @void@.
+%[numbers=left] Why numbers on this one?
 \begin{cfa}
 void main(CountUp & this) {
-    for (unsigned int next = 0 ; true ; ++next) {
+	for (unsigned int next = 0 ; true ; ++next) {
 		next = up;
 		suspend;$\label{suspend}$
