[m-dev.] Re: exceptions

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Oct 8 15:51:57 AEST 1999


On 08-Oct-1999, Tomas By <tomas at research.nj.nec.com> wrote:
> I have been looking at exceptions and I feel a little ... bewildered.
> 
> Can you tell me something about your plans for exceptions in the
> library? How many exceptions types will there be? One per module? Will
> the exceptions be well defined? Listed in the interface?

That much has not been planned in great detail at this point.

But my plan involves adding support for dynamic type class casts.
We will then establish some standard hierarchy of type classes for
categorizing exceptions.  So it won't be necessary to document
exactly which types will be thrown, only which categories (type classes)
they fall into.

> Do you plan to have the compiler check things like whether a given
> exception is caught or not?

The additional complexity of declaring which exceptions may be thrown
doesn't seem worth the benefits, IMHO.  

There are two categories of errors which can occur in _any_ predicate:
	- software errors, e.g. calls to error/1
	- resource errors, e.g. running out of heap space
	  or exceeding a CPU usage time limit

At very least, those ones should not be declared.
And if those are not declared, then the benefit in declaring others
is reduced.

Furthermore, the sorts of exceptions which can be thrown is often
quite dependent on the implementation details of the procedure.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list