On Tue, 16 Jun 1998, Erik Zuurbier wrote:

> I have read many, but not all of the messages on this subject. Did any of those
> shed any light on the intended use of exceptions? Maybe that could explain
> the disagreement. I can imagine:
> 1) You use exceptions for debugging your program, with the goal (naive maybe)
> that none will ever be raised in the final program.
> 2) You learn to rely on the defined behaviour, deterministic or not, and the final
> program can be perfectly acceptable if it raises any number of exceptions as long
> as they are caught and handled in time. Exceptions are merely a way to structure
> the code, so that the main line and error handling can be neatly separated.

There's a third case, I think:

3) You are writing code which may be reused (either by design or
fortuitous circumstance); consequently if any of your `externally usable'
functions can throw an exception, you can't rely upon the user reading and
understanding you code to the degree that they appreciate all the nuances
of exactly which exception was thrown in some intricate circumstance. (I
think haskell is still a way from the C++ situation where there are
distributed _binary libraries_ which can throw exceptions, so you can't
assume you can even read the source.) Thus you have to deliberately make
circumstances where knowing _exactly_ what the primary error is (rather
than just that `an error occurred whilst doing this overall thing')
exactly predictable yourself, strictifying code if necessary.


cheers, dave
------------------------------------------------------------------------
email: [EMAIL PROTECTED]       "Taught the wife some html. __Bad
www.cs.bris.ac.uk/~tweed/pi.htm   move__." -- Alan Cox
work tel: (0117) 954-5253          


Reply via email to