Changeset fcaa1e4
- Timestamp:
- Jul 19, 2021, 2:53:31 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 63bde81
- Parents:
- d2278e9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/intro.tex
rd2278e9 rfcaa1e4 107 107 108 108 Exception handling is not a new concept, 109 with papers on the subject dating back 70s. 110 111 Their were popularised by \Cpp, 109 with papers on the subject dating back 70s.\cite{Goodenough} 110 111 Early exceptions were often treated as signals. They carried no information 112 except their identity. Ada still uses this system. 113 114 The modern flag-ship for termination exceptions is \Cpp, 112 115 which added them in its first major wave of non-object-orientated features 113 116 in 1990. 114 117 % 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. 119 However that seems to immediately pushed aside for classes inherited from 120 \code{C++}{std::exception}. 121 Although there is a special catch-all syntax it does not allow anything to 122 be done with the caught value becuase nothing is known about it. 123 So instead a base type is defined with some common functionality (such as 124 the ability to describe the reason the exception was raised) and all 125 exceptions have that functionality. 126 This seems to be the standard now, as the garentied functionality is worth 127 any lost flexibility from limiting it to a single type. 128 129 Java was the next popular language to use exceptions. 130 Its exception system largely reflects that of \Cpp, except that requires 131 you throw a child type of \code{Java}{java.lang.Throwable} 132 and it uses checked exceptions. 118 133 Checked exceptions are part of the function interface they are raised from. 119 134 This includes functions they propogate through, until a handler for that … … 131 146 Resumption exceptions have been much less popular. 132 147 Although resumption has a history as old as termination's, very few 133 programming languages have implement them.148 programming languages have implemented them. 134 149 % http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/parc/techReports/ 135 150 % CSL-79-3_Mesa_Language_Manual_Version_5.0.pdf 136 Mesa is one programming languages that did and experiance with that137 languagesis quoted as being one of the reasons resumptions were not151 Mesa is one programming languages that did. Experiance with Mesa 152 is quoted as being one of the reasons resumptions were not 138 153 included in the \Cpp standard. 139 154 % 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. 155 Since then resumptions have been ignored in the main-stream. 156 157 All of this does call into question the use of resumptions, is 158 something largely rejected decades ago worth revisiting now? 159 Yes, even if it was the right call at the time there have been decades 160 of other developments in computer science that have changed the situation 161 since then. 162 Some of these developments, such as in functional programming's resumption 163 equivalent: algebraic effects\cite{Zhang19}, are directly related to 164 resumptions as well. 165 A complete rexamination of resumptions is beyond a single paper, but it is 166 enough to try them again in \CFA. 167 % Especially considering how much easier they are to implement than 168 % termination exceptions. 169 170 %\subsection 171 Functional languages tend to use other solutions for their primary error 172 handling mechanism, exception-like constructs still appear. 173 Termination appears in error construct, which marks the result of an 174 expression as an error, the result of any expression that tries to use it as 175 an error, and so on until an approprate handler is reached. 176 Resumption appears in algebric effects, where a function dispatches its 177 side-effects to its caller for handling. 152 178 153 179 %\subsection 154 180 More 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. 181 languages, replaced by ``panic". 182 In Rust a panic is just a program level abort that may be implemented by 183 unwinding the stack like in termination exception handling. 160 184 % 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 is162 only a catch-all function with \code{Go}{recover()}. 163 So exceptions still are appearing, just in reduced forms.185 Go's panic through is very similar to a termination except it only supports 186 a catch-all by calling \code{Go}{recover()}, simplifying the interface at 187 the cost of flexability. 164 188 165 189 %\subsection
Note: See TracChangeset
for help on using the changeset viewer.