In which language did exceptions first appear?

2019-06-25 12:06发布

问题:

I first came across exceptions with ADA 83. As far as I know, the designers of ADA invented the concept of exceptions. Is this true, or did any programming language that came before use exceptions too?

回答1:

According to c2.com's Ground Breaking Languages page it was PL/I.



回答2:

It depends on how you define generics. Parametric polymorphism - which allows you to define functions and types that are not tied to particular argument / field types - was there in ML already - and that's 1973. There is a Standard ML sample from Wikipedia:

fun reverse [] = []
  | reverse (x::xs) = (reverse xs) @ [x]

Note that this function is statically typed, but polymorphic ("generic") on any type of list.

While this example is SML (which is a later thing), so far as I know, the concept was present in earliest ML versions as well.



回答3:

From Wikipedia:

Generic programming facilities first appeared in the 1970s in languages like CLU and Ada, and were subsequently adopted by many object-based and object-oriented languages, including BETA, C++, D, Eiffel, Java, and DEC's now defunct Trellis-Owl language. Implementations of generics in languages such as Java and C# are formally based on the notion of parametricity, due to John C. Reynolds.