[m-dev.] checked exceptions.

Peter Schachte schachte at unimelb.edu.au
Thu Feb 14 10:43:52 AEDT 2013


[I sent this reply from the wrong account and got a moderation message,
so I'm sending again.  Apologies if it's a repeat.]

>> What about an opt-in checked exception system:  A mercury construct you
>> can wrap around a goal or expression that promises that all exceptions
>> have been caught,

I meant something that _promises_ that all exceptions have been caught
somewhere below it in the call graph, not something that _catches_ any
exceptions.

Checked exceptions let you know what exceptions you need to worry about
when you call a function.  This idea won't help with that.  But at an
application level, checked exceptions tell you what exceptions might not
be handled inside your main function.  If you wrap this -- let's call it
ensure_no_uncaught_exceptions -- construct around your main, this will
give you that effect.  Just wrapping a try/catch around main could catch
all exceptions, but won't tell you what they could be, so you can't be
sure you handle them each appropriately.

-- 
Peter Schachte              Nothing in progression can rest on its
University of Melbourne     original plan. We may as well think of
schachte at unimelb.edu.au     rocking a grown man in the cradle of an
www.cs.mu.oz.au/~schachte/  infant.
Phone: +61 3 8344 1338          -- Edmund Burke, 1777



More information about the developers mailing list