Google Answers Logo
View Question
 
Q: The origin of checked exceptions ( Answered 4 out of 5 stars,   4 Comments )
Question  
Subject: The origin of checked exceptions
Category: Computers > Programming
Asked by: jhannes-ga
List Price: $8.00
Posted: 14 Jun 2002 14:48 PDT
Expires: 14 Jun 2003 14:48 PDT
Question ID: 26101
The Java programming language introduces the concept of /checked
exceptions/. Checked exceptions must be handled in a method or the
method must declare the exception in a /throws/ clause. This is as
opposed to /unchecked exceptions/; subclasses of RuntimeExceptions and
Errors, which do not require the same attention. If a programmer does
not address all checked exceptions, the compiler will signal an error.

Java is the first and only programming language I have seen that has
this feature. I have not been able to find any other language with
support for checked exceptions where the compilation generates signals
an error if the program does not handle the neccessary exceptions.

What other program languages than Java support checked exceptions?
Where did the ideas about checked exception originate?
Answer  
Subject: Re: The origin of checked exceptions
Answered By: richard-ga on 14 Jun 2002 15:28 PDT
Rated:4 out of 5 stars
 
Thank you for using Google Answers!

According to Ann Wollrath, who was there at the beginning, the credit
for the Java exception scheme should mostly go to Jim Waldo:

"There was a time when Oak and the earliest version of Java did not
have checked exceptions. Exception handling was advisory, and it
was an unsafe world out there. It was our group (Jim Waldo and I
in particular :-) that recommended that there be exceptions checked
by the compiler. Jim was quite persuasive in his arguments, telling
of a world where robust code would reign. After some consideration,
Java was retooled to have checked exceptions. Only those exceptions
for which there was no recovery or reflect application errors would
be unchecked (e.g., OutOfMemoryError, NullPointerException
respectively). And the world was safe again."
     --Ann Wollrath
< java.sun.com/products/jdk/rmi/archives/3490.html >

Mr. Waldo's current title is "Distinguished Engineer, Architect for
the Jini Network Technology, Sun Microsystems Inc."

Java would appear to be the first code to use this approach.

Thanks for your question!
jhannes-ga rated this answer:4 out of 5 stars

Comments  
Subject: Re: The origin of checked exceptions
From: capritius-ga on 14 Jun 2002 16:59 PDT
 
"Java would appear to be the first code to use this approach."

Not at all!  

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,
more recently Python and Ruby; I recall using C++'s exception handling
at the time that I read Java's initial spec.

The concept of unchecked exceptions was Java's surprising
contribution, later corrected by adding checked exceptions -- my guess
is this was in 1995 or '96, based on where I was working when I saw
the first Java spec, and heard about this issue.

--Patricia
Subject: Re: The origin of checked exceptions
From: jhannes-ga on 14 Jun 2002 17:13 PDT
 
Patricia

I am afraid you mix up the terminology of checked and unchecked
exceptions. Java seems to be the only language supporting /checked/
exceptions. The other languages you mention does not have any compile
time checking of exception specifications. The exception mechanism of
these languages correspond to /unchecked/ exceptions in Java.
Subject: Re: The origin of checked exceptions
From: ark-ga on 14 Jun 2002 21:04 PDT
 
I am fairly certain that Modula-3, which predates Java, has checked
exceptions in the sense you mention.  I am also moderately certain
that Clu also has checked exceptions, but I am much less familiar with
Clu than I am with Modula-3 so I am less certain about that.
Subject: Re: The origin of checked exceptions
From: capritius-ga on 15 Jun 2002 11:30 PDT
 
You said "The exception mechanism of these languages correspond to
/unchecked/ exceptions in Java."

ARRRGH.  You're right, and my comment was wrong.  This is what I get
for answering a question about a language that I haven't used since I
played with it many years ago.  In expiation, here is a thoughtful
article about when to use checked exceptions and when to use unchecked
exceptions in Java:

http://www.javaworld.com/javaworld/jw-08-2000/jw-0818-exceptions.html

and here is a thoughtful article about whether checked exceptions are
a good idea, and why they may not have been taken up by other
languages:

http://www.mindview.net/Etc/Discussions/CheckedExceptions

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy