Apr 29, 2021, 10:58:35 AM (3 years ago)
Andrew Beach <ajbeach@…>
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum

Andrew MMath: Went over the features chapter again.

1 edited


  • doc/theses/andrew_beach_MMath/features.tex

    rc1136c56 ra6c45c6  
    101101between different sub-hierarchies.
    102102This design is used in \CFA even though it is not a object-orientated
    103 language using different tools to create the hierarchy.
     103language; so different tools are used to create the hierarchy.
    105105% Could I cite the rational for the Python IO exception rework?
    124124Virtual types and casts are not part of \CFA's EHM nor are they required for
    125 any EHM. But \CFA uses a hierarchial system of exceptions and this feature
    126 is leveraged to create that.
    128 % Maybe talk about why the virtual system is so minimal.
    129 % Created for but not a part of the exception system.
     125any EHM.
     126However the \CFA uses a hierarchy built with the virtual system as the basis
     127for exceptions and exception matching.
     129The virtual system would have ideally been part of \CFA before the work
     130on exception handling began, but unfortunately it was not.
     131Because of this only the features and framework needed for the EHM were
     132designed and implemented. Other features were considered to ensure that
     133the structure could accomidate other desirable features but they were not
     135The rest of this section will only discuss the finalized portion of the
     136virtual system.
    131138The virtual system supports multiple ``trees" of types. Each tree is
    175182While much of the virtual infrastructure is created, it is currently only used
    176183internally for exception handling. The only user-level feature is the virtual
    177 cast, which is the same as the \Cpp \lstinline[language=C++]|dynamic_cast|.
     184cast, which is the same as the \Cpp \codeCpp{dynamic_cast}.
    198205trait is_exception(exceptT &, virtualT &) {
    199         virtualT const & get_exception_vtable(exceptT *);
     206        // Numerous imaginary assertions.
    202209The trait is defined over two types, the exception type and the virtual table
    203 type. This should be one-to-one: each exception type has only one virtual
    204 table type and vice versa. The only assertion in the trait is
    205 @get_exception_vtable@, which takes a pointer of the exception type and
    206 returns a reference to the virtual table type instance.
    208 % TODO: This section, and all references to get_exception_vtable, are
    209 % out-of-data. Perhaps wait until the update is finished before rewriting it.
    210 The function @get_exception_vtable@ is actually a constant function.
    211 Regardless of the value passed in (including the null pointer) it should
    212 return a reference to the virtual table instance for that type.
    213 The reason it is a function instead of a constant is that it make type
    214 annotations easier to write as you can use the exception type instead of the
    215 virtual table type; which usually has a mangled name.
    216 % Also \CFA's trait system handles functions better than constants and doing
    217 % it this way reduce the amount of boiler plate we need.
     210type. Each exception type should have but a single virtual table type.
     211Now there are no actual assertions in this trait because the trait system
     212actually can't express them (adding such assertions would be part of
     213completing the virtual system). The imaginary assertions would probably come
     214from a trait defined by the virtual system, and state that the exception type
     215is a virtual type, is a decendent of @exception_t@ (the base exception type)
     216and note its virtual table type.
    219218% I did have a note about how it is the programmer's responsibility to make
    473472The symmetry between resumption termination is why this pattern was picked.
    474473Other patterns, such as marking just the handlers that caught, also work but
    475 lack the symmetry means there are less rules to remember.
     474lack the symmetry means there are more rules to remember.
    477476\section{Conditional Catch}
    559558If there are further handlers after this handler only the first version will
    560 check them. If multiple handlers on a single try block could handle the same
    561 exception the translations get more complex but they are equivilantly
     559check them. If multiple handlers on a single try block that could handle the
     560same exception the translations get more complex but they are equivilantly
    634633and the current stack is
    635634unwound. After that it depends one which stack is being cancelled.
    636 \begin{description}
    637 \item[Main Stack:]
     636\paragraph{Main Stack}
    638637The main stack is the one used by the program main at the start of execution,
    639638and is the only stack in a sequential program.
    646645to, so it would have be explicitly managed.
    648 \item[Thread Stack:]
     647\paragraph{Thread Stack}
    649648A thread stack is created for a \CFA @thread@ object or object that satisfies
    650649the @is_thread@ trait.
    672671Also you can always add an explicit join if that is the desired behaviour.
    674 \item[Coroutine Stack:]
     673\paragraph{Coroutine Stack}
    675674A coroutine stack is created for a @coroutine@ object or object that
    676675satisfies the @is_coroutine@ trait.
    686685(in terms of coroutine state) called resume on this coroutine, so the message
    687686is passed to the latter.
    688 \end{description}
Note: See TracChangeset for help on using the changeset viewer.