[m-dev.] checked exceptions.

Paul Bone paul at bone.id.au
Wed Feb 13 11:19:16 AEDT 2013


On Wed, Feb 13, 2013 at 10:52:12AM +1100, David Overton wrote:
> On 13 February 2013 10:32, Paul Bone <paul at bone.id.au> wrote:
> > If your method might throw a checked exception then it must declare the
> > possibility of the exception as part of it's signature.  Any method calling
> > this method is forced either to catch and handle the exception, or to
> > declare that it may be thrown.
> 
> How would this work with higher-order code?

The best solution would be to make it polymorphic.

If P in map(P, ...) may throw an exception, then map may also throw the same
exception.

If we were to put P inside some other structure this would be a problem, the
exception information has to be used with the structure.

The simplest solution here is to not copy the exception information and give
a warning.  Other solutions involve modyfing either the type or mode system,
depends on how we want to model this.

The problem also arises in the use of typeclasses.  If an instance of a
typeclass method throws an exception it must be reflected in the typeclass,
or the instance must be invalid.


-- 
Paul Bone
http://www.bone.id.au



More information about the developers mailing list