[mercury-users] question about error/1

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Jan 24 15:54:41 AEDT 2008


On Thu, 24 Jan 2008, Ralph Becket wrote:

> Mark Brown, Thursday, 24 January 2008:
>>
>> I think we should export code like this from the exception module.  Eg:
>>
>> 	try_main(MyMain, MsgPred, !IO)
>>
>> where MyMain has a signature like main/2, and MsgPred accepts a string
>> input and an io pair.  If MyMain throws an exception of the type generated
>> by the "abort with message" predicate, then MsgPred is called with the
>> given string.
>
> Why not encapsulate the print pred in the exception itself?

Why?  You may want to do things with exceptions other than print them
out.

I don't think anything extra is necessary - it is not that much
work to stick try_io at the top-level of your program.

Julien.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list