Changeset fcaa1e4


Ignore:
Timestamp:
Jul 19, 2021, 2:53:31 PM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
63bde81
Parents:
d2278e9
Message:

Andrew MMath: Updated the introduction/background section.

File:
1 edited

Legend:

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

    rd2278e9 rfcaa1e4  
    107107
    108108Exception handling is not a new concept,
    109 with papers on the subject dating back 70s.
    110 
    111 Their were popularised by \Cpp,
     109with papers on the subject dating back 70s.\cite{Goodenough}
     110
     111Early exceptions were often treated as signals. They carried no information
     112except their identity. Ada still uses this system.
     113
     114The modern flag-ship for termination exceptions is \Cpp,
    112115which added them in its first major wave of non-object-orientated features
    113116in 1990.
    114117% https://en.cppreference.com/w/cpp/language/history
    115 
    116 Java was the next popular language to use exceptions. It is also the most
    117 popular language with checked exceptions.
     118\Cpp has the ability to use any value of any type as an exception.
     119However that seems to immediately pushed aside for classes inherited from
     120\code{C++}{std::exception}.
     121Although there is a special catch-all syntax it does not allow anything to
     122be done with the caught value becuase nothing is known about it.
     123So instead a base type is defined with some common functionality (such as
     124the ability to describe the reason the exception was raised) and all
     125exceptions have that functionality.
     126This seems to be the standard now, as the garentied functionality is worth
     127any lost flexibility from limiting it to a single type.
     128
     129Java was the next popular language to use exceptions.
     130Its exception system largely reflects that of \Cpp, except that requires
     131you throw a child type of \code{Java}{java.lang.Throwable}
     132and it uses checked exceptions.
    118133Checked exceptions are part of the function interface they are raised from.
    119134This includes functions they propogate through, until a handler for that
     
    131146Resumption exceptions have been much less popular.
    132147Although resumption has a history as old as termination's, very few
    133 programming languages have implement them.
     148programming languages have implemented them.
    134149% http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/parc/techReports/
    135150%   CSL-79-3_Mesa_Language_Manual_Version_5.0.pdf
    136 Mesa is one programming languages that did and experiance with that
    137 languages is quoted as being one of the reasons resumptions were not
     151Mesa is one programming languages that did. Experiance with Mesa
     152is quoted as being one of the reasons resumptions were not
    138153included in the \Cpp standard.
    139154% https://en.wikipedia.org/wiki/Exception_handling
    140 \todo{A comment about why we did include them when they are so unpopular
    141 might be approprate.}
    142 
    143 %\subsection
    144 Functional languages, tend to use solutions like the return union, but some
    145 exception-like constructs still appear.
    146 
    147 For instance Haskell's built in error mechanism can make the result of any
    148 expression, including function calls. Any expression that examines an
    149 error value will in-turn produce an error. This continues until the main
    150 function produces an error or until it is handled by one of the catch
    151 functions.
     155Since then resumptions have been ignored in the main-stream.
     156
     157All of this does call into question the use of resumptions, is
     158something largely rejected decades ago worth revisiting now?
     159Yes, even if it was the right call at the time there have been decades
     160of other developments in computer science that have changed the situation
     161since then.
     162Some of these developments, such as in functional programming's resumption
     163equivalent: algebraic effects\cite{Zhang19}, are directly related to
     164resumptions as well.
     165A complete rexamination of resumptions is beyond a single paper, but it is
     166enough to try them again in \CFA.
     167% Especially considering how much easier they are to implement than
     168% termination exceptions.
     169
     170%\subsection
     171Functional languages tend to use other solutions for their primary error
     172handling mechanism, exception-like constructs still appear.
     173Termination appears in error construct, which marks the result of an
     174expression as an error, the result of any expression that tries to use it as
     175an error, and so on until an approprate handler is reached.
     176Resumption appears in algebric effects, where a function dispatches its
     177side-effects to its caller for handling.
    152178
    153179%\subsection
    154180More recently exceptions seem to be vanishing from newer programming
    155 languages.
    156 Rust and Go reduce this feature to panics.
    157 Panicing is somewhere between a termination exception and a program abort.
    158 Notably in Rust a panic can trigger either, a panic may unwind the stack or
    159 simply kill the process.
     181languages, replaced by ``panic".
     182In Rust a panic is just a program level abort that may be implemented by
     183unwinding the stack like in termination exception handling.
    160184% https://doc.rust-lang.org/std/panic/fn.catch_unwind.html
    161 Go's panic is much more similar to a termination exception but there is
    162 only a catch-all function with \code{Go}{recover()}.
    163 So exceptions still are appearing, just in reduced forms.
     185Go's panic through is very similar to a termination except it only supports
     186a catch-all by calling \code{Go}{recover()}, simplifying the interface at
     187the cost of flexability.
    164188
    165189%\subsection
Note: See TracChangeset for help on using the changeset viewer.