Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Where did exceptions and exception handling come from?

I like how .NET uses it, I like how C++ supports it (but libraries unfortunately use return code or is written in C instead). I know its pretty much standard in all new languages, but who designed it first or where did it come from?

Is C++ the first language to use it? I don't know of any other that is older.

share|improve this question
7  
Apparently, Plankalkül had exception handling in the 1940's, though the first compiler didn't exist until about 50 years later. (en.wikipedia.org/wiki/Plankalk%C3%BCl) –  FrustratedWithFormsDesigner Jan 26 '11 at 22:15
    
You could say that C++ was the first not ivory tower language that introduced exceptions to the masses. But the concept has been around since the beginning (or a long time, take your pick). –  Loki Astari Jan 26 '11 at 22:24
10  
Looking for someone to strangle? I'm kidding... –  Mark Canlas Jan 26 '11 at 22:51
1  
Should we take into account the influences from hardware exceptions? –  rwong Jan 27 '11 at 6:09
1  
@FrustratedWithFormsDesigner: My jaw just hit the floor. I knew of Konrad Zuse, but didn't know that. He is the father of us all. –  Bob Murphy Jul 26 '11 at 15:32
show 2 more comments

2 Answers

up vote 20 down vote accepted

Raising and trapping exceptions has been around for quite a time. This site says exceptions were introduced in PL/I: http://www.math.grin.edu/~rebelsky/Courses/CS302/98S/Outlines/outline.02.html

which was in 1967, according to this page (includes an extensive but not exhaustive chart of computer languages and features): http://community.borland.com/article/0,1410,22741,00.html

Many languages picked up this technique -- ADA, ALGOL, FORTRAN, ML [...]

Quoted from here.

Wikipedia has more detail about exception handling in PL/1. That page also refers to PL/1 being the first. Of course, this is no scientific proof :-)

As for who in person designed PL/1, the article mentions no names, only various committees at IBM.

share|improve this answer
    
Execptions in PL/I were really specific types of events. You could define and raise your own events and write event handlers to catch them. ISTR there was some support for this in some system facilities (VTAM?), so you could actually write event-driven programs. –  TMN Jul 26 '11 at 14:21
    
Can you think of any languages prior to C++ which provided a facility for orderly cleanup during stack unwinding? –  supercat Jan 8 '13 at 18:02
    
Exceptions in FORTRAN? Come on... –  Michał Kosmulski Nov 3 '13 at 10:56
add comment

Hof, Mössenböck and Pirkelbauer (in their 1997 paper Zero-Overhead Exception Handling using Metaprogramming) affirm that the concept of exceptions was suggested in the seventies, referring to John B. Goodenough's 1975 Exception handling: Issues and a proposed notation paper in the Communications of the ACM. In it he conflates modern exception handling with the general idea of registering callbacks, and his proposed notation looks more like modern Attribute metadata specifications than try/catch, but it (or at least its section 2) is a great overview of the state of exception handling in the mid-seventies.

Perhaps of note is also the raise/rescue mechanism in Alef, which one can view as a primitive form of catch blocks, lest we think they sprang fully-formed from Stroustroup's brow like Athena from Zeus's.

share|improve this answer
3  
did you read prior answer? It dates exceptions 1967: eight years earlier than the date you refer to –  gnat Nov 2 '13 at 17:36
4  
I did, but I was trying to trace some of the history between the appearance of exceptions in C++ and the ON CONDITION statements in PL/I. I guess my addition was unwelcome? –  Wtrmute Nov 2 '13 at 20:41
1  
Actually, many papers on exception handling refer to goodenough for the overview, discussion and its influence on modern exception mechanism -- its reasonable to consider it seminal. On the other hand, "exception handling" has distinct semantics in many languages, and I would expect this to be specially true before Goodenough's publication. With this in mind, a conservative answer to this question could just as well trace it back to a conditional jump. –  Thiago Silva Nov 3 '13 at 2:01
    
@gnat: Did you read the comment that traces the idea to the 1940's? Even if that comment didn't exist, the question is "where did exceptions come from?", not "name the earliest date when exceptions were used". –  Michael Shaw Nov 3 '13 at 3:06
    
@MichaelShaw the answer I refer to has been posted at the same time as comment you mention, and it also attempts to address the question asked ("being the first"). As opposed to it, this post failed to acknowledge apparently visible earlier evidence and didn't even tried to address the question –  gnat Nov 3 '13 at 7:52
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.