gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] using exceptions


From: Syan Tan
Subject: Re: [Gnumed-devel] using exceptions
Date: Sun, 01 Jan 2006 04:49:01 +0800


not sure if python has checked/unchecked exceptions ( probably not).  it's a little difficult understanding why

someone would want to throw an unchecked exception ( e.g. a RuntimeException) , as it sort of makes

client programmers have to revise their code once it gets thrown ( given Murphy's law). 

e.g. for the StackEmpty runtime exception, and the StringTokenizerEmpty runtime exception, the

reason give for making the exceptions unchecked is that the programmer is assumed to understand

to always call hasMoreXXX before calling getNextXXX , but the compiler doesn't check that for  you.

If they were checked exceptions, then a programmer really confident that it wouldn't get thrown,

could put in the exception clause ; "System.err.println(e + ' thrown. Shouldn't happen !'); System.exit(-1);

I suppose with runtime exceptions, there is no setup of an exception harness, so methods that don't

throw exceptions run quicker.



On Sat Dec 31 16:43 , Karsten Hilbert sent:

Ian,

http://www.javaworld.com/javaworld/jw-07-1998/jw-07-techniques_p.html

Following these guidelines (apart from there no being no
checked vs unchecked exceptions) plus *not* using the string
interface but only the class interface on exceptions would
bode well with me in future code.

We could link the above from the Wiki.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346


_______________________________________________
Gnumed-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/gnumed-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]