Content deleted Content added
m clean up, typo(s) fixed: For example → For example, |
Fgnievinski (talk | contribs) completing fork from Exception handling |
||
Line 19:
| edition = Second
}}</ref> C#, Common Lisp, Eiffel, and Modula-2.
== History ==
Software exception handling developed in the 1960s and 1970s. [[LISP 1.5]] (1958-1961)<ref>{{cite web |last1=McCarthy |first1=John |title=History of Lisp |url=http://www-formal.stanford.edu/jmc/history/lisp/node1.html |website=www-formal.stanford.edu |access-date=13 January 2022 |date=12 February 1979}}</ref> allowed exceptions to be raised by the <code>ERROR</code> pseudo-function, similarly to errors raised by the interpreter or compiler. Exceptions were caught by the <code>ERRORSET</code> keyword, which returned <code>NIL</code> in case of an error, instead of terminating the program or entering the debugger.<ref>{{cite book|
first1=John|last1=McCarthy|first2=Michael I.|last2=Levin|first3=Paul W.|last3=Abrahams|first4=Daniel J.|last4=Edwards|first5=Timothy P.|last5=Hart
|title=LISP 1.5 programmer's manual |date=14 July 1961 |url=http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual-1961.07.14.pdf#page=58 |access-date=13 January 2022}}</ref>
[[PL/I#ON-units and exception handling|PL/I]] introduced its own form of exception handling circa 1964, allowing interrupts to be handled with ON units.<ref>{{cite manual
| title = IBM System/360 Operating System, PL/I Language Specifications
| id = C28-6571-3
| date = July 1966
| page = 120
| section = The ON Statement
| section-url = http://www.bitsavers.org/pdf/ibm/360/pli/C28-6571-3_PL_I_Language_Specifications_Jul66.pdf#page=120
| url = http://www.bitsavers.org/pdf/ibm/360/pli/C28-6571-3_PL_I_Language_Specifications_Jul66.pdf
| publisher = IBM
}}
</ref>
[[MacLisp]] observed that <code>ERRSET</code> and <code>ERR</code> were used not only for error raising, but for non-local control flow, and thus added two new keywords, <code>CATCH</code> and <code>THROW</code> (June 1972).{{sfn|Gabriel|Steele|2008|p=3}} The cleanup behavior now generally called "finally" was introduced in [[NIL (programming language)|NIL]] (New Implementation of LISP) in the mid- to late-1970s as <code>UNWIND-PROTECT</code>.{{sfn|White|1979|p=194}} This was then adopted by [[Common Lisp]]. Contemporary with this was <code>dynamic-wind</code> in Scheme, which handled exceptions in closures. The first papers on structured exception handling were {{harvtxt|Goodenough|1975a}} and {{harvtxt|Goodenough|1975b}}.{{sfn|Stroustrup|1994|p=392}} Exception handling was subsequently widely adopted by many programming languages from the 1980s onward.
== Syntax ==
|