The origin of the try / catch / finally syntax

The question for etymology masters is: which programming language was the first to use the try / catch / finally syntax that was found in today's Java / .NET languages?

+6
source share
4 answers

I believe that it was C ++, and I think that Java / C # was finally added to clear resources (finally not in C ++). Unfortunately, I have no links ... yet .

A neat page for all exception syntax: http://en.wikipedia.org/wiki/Exception_handling_syntax

I believe this is C ++. If he is not, then Straustrup should give a loan. In his article: http://www.research.att.com/~bs/except.pdf He does not mention any influences and does not refer to any other material other than his own.

+4
source

C ++ was the first main programming language for introducing exceptions (finally, in C ++ it is not required because destructors are deterministic). From a Stroustrup document: http://www2.research.att.com/~bs/hopl2.pdf

the greatest impact on C ++ The design for exception handling is the work on fault systems that were discovered at the University of Newcastle in England by Brian Randall and his colleagues and continued in many places since

+3
source

Mike Fykes tweeted , Paweł Kapała shared with me:

MacLisp has added an ERR function that signals an error. If ERR is called in the dynamic context of the ERRSET form, then the ERR argument is returned as the value of the ERRSET form.

Programmers soon began to use ERRSET and ERR , so as not to catch and not to signal errors, but for more general control purposes (dynamic non-local outputs). Unfortunately, this use of ERRSET also calmly captures unexpected errors, making it difficult to debug programs. A new pair of CATCH and THROW primitives was introduced in MacLisp in June 1972 [emphasis mine] so that ERRSET can be reserved for the intended use of error capture.

The lesson of ERRSET and CATCH important. The designers of ERRSET , and then ERR had in mind the specific situation and identified a couple of primitives to solve this situation. But since these tools provided a combination of useful and powerful features (error capture and dynamic non-local outputs), programmers began to use these objects inadvertently. Then the designers had to go back and split what they wanted using alternative interfaces. This scheme of careful design, unintended use, and subsequent redesign is common in the evolution of Lisp.

- from Lisp Evolution by Guy Steele and Richard Gabriel

image of this text from below below Source: https://twitter.com/mfikes/status/881943130588753920

 <blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">"The Evolution of Lisp," by Guy Steele and Richard Gabriel</p>&mdash; Mike Fikes (@mfikes) <a href="https://twitter.com/mfikes/status/881950560508940288">July 3, 2017</a></blockquote> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> 
+3
source

Common Lisp precedes C ++ for a long time and was based on earlier Lispx. Java, of course, was created by people from Lisp who knew this very well. But Java is contaminated with Lisp due to C, so they also added the proven nonsense of the exception specification.

Common Lisp went further and actually allowed the catch to interact with the throwing procedure, including saying that the throw would continue. The stack simply did not unwind until the catch was done. This meant that you could issue warnings, such as out of memory, as well as a crash.

0
source

Source: https://habr.com/ru/post/888854/


All Articles