Changeset 67c6a47 for doc/theses


Ignore:
Timestamp:
Mar 6, 2021, 5:09:49 PM (8 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
223ee0d
Parents:
d06707e
Message:

proofread Andrew's thesis chapter existing.tex

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/andrew_beach_MMath/existing.tex

    rd06707e r67c6a47  
    1414\section{Overloading and \lstinline{extern}}
    1515\CFA has extensive overloading, allowing multiple definitions of the same name
    16 to be defined.~\cite{Moss18}
     16to be defined~\cite{Moss18}.
    1717\begin{cfa}
    1818char i; int i; double i;                        $\C[3.75in]{// variable overload}$
     
    4646pointers using the ampersand (@&@) instead of the pointer asterisk (@*@). \CFA
    4747references may also be mutable or non-mutable. If mutable, a reference variable
    48 may be assigned to using the address-of operator (@&@), which converts the
     48may be assigned using the address-of operator (@&@), which converts the
    4949reference to a pointer.
    5050\begin{cfa}
     
    5858\section{Constructors and Destructors}
    5959
    60 Both constructors and destructors are operators, which means they are just
     60Both constructors and destructors are operators, which means they are
    6161functions with special operator names rather than type names in \Cpp. The
    6262special operator names may be used to call the functions explicitly (not
     
    6464
    6565In general, operator names in \CFA are constructed by bracketing an operator
    66 token with @?@, which indicates where the arguments. For example, infixed
     66token with @?@, which indicates the position of the arguments. For example, infixed
    6767multiplication is @?*?@ while prefix dereference is @*?@. This syntax make it
    6868easy to tell the difference between prefix operations (such as @++?@) and
     
    8989definition, \CFA creates a default and copy constructor, destructor and
    9090assignment (like \Cpp). It is possible to define constructors/destructors for
    91 basic and existing types.
     91basic and existing types (unlike \Cpp).
    9292
    9393\section{Polymorphism}
     
    120120        do_once(value);
    121121}
    122 void do_once(int i) { ... }  // provide assertion
    123 int i;
     122void do_once(@int@ i) { ... }  // provide assertion
     123@int@ i;
    124124do_twice(i); // implicitly pass assertion do_once to do_twice
    125125\end{cfa}
     
    172172declarations instead of parameters, returns, and local variable declarations.
    173173\begin{cfa}
    174 forall(dtype T)
     174forall(dtype @T@)
    175175struct node {
    176         node(T) * next;  // generic linked node
    177         T * data;
    178 }
     176        node(@T@) * next;  // generic linked node
     177        @T@ * data;
     178}
     179node(@int@) inode;
    179180\end{cfa}
    180181The generic type @node(T)@ is an example of a polymorphic-type usage.  Like \Cpp
    181 templates usage, a polymorphic-type usage must specify a type parameter.
     182template usage, a polymorphic-type usage must specify a type parameter.
    182183
    183184There are many other polymorphism features in \CFA but these are the ones used
    184185by the exception system.
    185186
    186 \section{Concurrency}
    187 \CFA has a number of concurrency features: @thread@, @monitor@, @mutex@
    188 parameters, @coroutine@ and @generator@. The two features that interact with
    189 the exception system are @thread@ and @coroutine@; they and their supporting
     187\section{Control Flow}
     188\CFA has a number of advanced control-flow features: @generator@, @coroutine@, @monitor@, @mutex@ parameters, and @thread@.
     189The two features that interact with
     190the exception system are @coroutine@ and @thread@; they and their supporting
    190191constructs are described here.
    191192
     
    216217CountUp countup;
    217218\end{cfa}
    218 Each coroutine has @main@ function, which takes a reference to a coroutine
     219Each coroutine has a @main@ function, which takes a reference to a coroutine
    219220object and returns @void@.
    220221\begin{cfa}[numbers=left]
     
    230231In this function, or functions called by this function (helper functions), the
    231232@suspend@ statement is used to return execution to the coroutine's caller
    232 without terminating the coroutine.
     233without terminating the coroutine's function.
    233234
    234235A coroutine is resumed by calling the @resume@ function, \eg @resume(countup)@.
     
    242243@resume(countup).next@.
    243244
    244 \subsection{Monitors and Mutex}
     245\subsection{Monitor and Mutex Parameter}
    245246Concurrency does not guarantee ordering; without ordering results are
    246247non-deterministic. To claw back ordering, \CFA uses monitors and @mutex@
     
    260261and only one runs at a time.
    261262
    262 \subsection{Threads}
     263\subsection{Thread}
    263264Functions, generators, and coroutines are sequential so there is only a single
    264265(but potentially sophisticated) execution path in a program. Threads introduce
     
    268269monitors and mutex parameters. For threads to work safely with other threads,
    269270also requires mutual exclusion in the form of a communication rendezvous, which
    270 also supports internal synchronization as for mutex objects. For exceptions
    271 only the basic two basic operations are important: thread fork and join.
     271also supports internal synchronization as for mutex objects. For exceptions,
     272only two basic thread operations are important: fork and join.
    272273
    273274Threads are created like coroutines with an associated @main@ function:
Note: See TracChangeset for help on using the changeset viewer.