[PPL-devel] PPL compiled with native integers

Roberto Bagnara bagnara at cs.unipr.it
Thu Dec 18 11:34:41 CET 2008


Fausto Spoto wrote:
> In general one should not define new
> instances of RuntimeException but nevermind.

Enea has checked the following document:

http://www.j2ee.me/docs/books/tutorial/essential/exceptions/runtime.html

Here it is said:


     Runtime exceptions represent problems that are the result of a
     programming problem, and as such, the API client code cannot
     reasonably be expected to recover from them or to handle them in any
     way. Such problems include arithmetic exceptions, such as dividing by
     zero; pointer exceptions, such as trying to access an object through a
     null reference; and indexing exceptions, such as attempting to access
     an array element through an index that is too large or too small.

Hence, it seems that it is meaningful to throw a runtime exception
when we have an overflow.

Below in the same document it is also said:

     One case where it is common practice to throw a RuntimeException is
     when the user calls a method incorrectly. For example, a method can
     check if one of its arguments is incorrectly null. If an argument is
     null, the method might throw a NullPointerException, which is an
     unchecked exception.

Hence, it also seem that it is meaningful to throw a runtime exception
when the PPL is called by passing in an invalid argument.
Don't you agree?
Cheers,

     Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list