Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What language was the first to implement exception handling?

This question is not a technical but a historical one. I was just thinking today that I've also thought of Java as the "first" language to use exception handling, until I realized that my reason for thinking this way is probably because Java was the first language I encountered that used it, but I had no historical data to back up that conclusion. Nowadays exception handling is commonplace in all modern languages, so I'm just wondering: does anyone know when it first started being widely used? And what language was the first to start using it?

like image 490
soapergem Avatar asked Sep 20 '09 00:09

soapergem


People also ask

In which programming language was exception handling first implemented?

Arithmetic overflow executed two instructions at address 0, which could transfer control or fix up the result. Software exception handling developed in the 1960s and 1970s. LISP 1.5 (1958-1961) allowed exceptions to be raised by the ERROR pseudo-function, similarly to errors raised by the interpreter or compiler.

What is exception handling in programming language?

Exception handling is the process of responding to unwanted or unexpected events when a computer program runs. Exception handling deals with these events to avoid the program or system crashing, and without this process, exceptions would disrupt the normal operation of a program.

When was try catch invented?

A new pair of primitives, CATCH and THROW , was introduced into MacLisp in June 1972 [emphasis mine] so that ERRSET could be reserved for its intended use of error trapping.

What is exception handling in Python?

An Exception is an error that happens during the execution of a program. Whenever there is an error, Python generates an exception that could be handled. It basically prevents the program from getting crashed.


2 Answers

Programming Languages: Principles and Practice, 2nd edition, by Kenneth C. Louden (a notable textbook on programming languages) notes that "Exception handling was pioneered by the language PL/I in the 1960s and significantly advanced in CLU in the 1970s. However, it was only in the 1980s and early 1990s that design questions were largely resolved" (283).

like image 191
mipadi Avatar answered Oct 27 '22 14:10

mipadi


Exception handling really goes back to even before programming languages; at first, it was a hardware mechanism for trapping error conditions (those that caused an execution halt) and optionally branching to a subroutine.

For example, the VAX CPU could detect when a virtual address that had no physical mapping was accessed, and call into a subroutine that either loaded the appropriate page from swap, or halted the program. The mechanism is essentially the same in modern processors (look up "translation lookaside buffer"). So in a sense the first language to have exceptions was assembly.

The earliest structured languages to have exceptions appear to be PL/I and CLU (see Mipadi above).

like image 23
Crashworks Avatar answered Oct 27 '22 15:10

Crashworks