[mercury-users] exceptions considered bloody annoying
Ralph Becket
rafe at cs.mu.OZ.AU
Tue Apr 16 15:42:20 AEST 2002
Michael Day, Tuesday, 16 April 2002:
>
> As soon as you start destructively updating unique structures you're back
> in C++ land and you can't abandon a line of computation without losing
> your data. But exceptions give you the idea that you can, that you can
> just throw one and it's like backtracking and everything will be alright.
My impression is that most complaints about exception handling in
Mercury is that it *doesn't* allow you to catch an exception and then do
an ad-hoc (or not even bother to) patch up of old versions of data
structures you have lying around at the call site.
To guarantee integrity of such structures in the presence of exceptions,
you have to use the proper machinery.
> Here is a proposal: remove try and try_io from the library. If you want to
> run dynamically loaded code without putting yourself at risk of errors,
> then fork a child process to dynamically load and execute the code. It can
> throw an exception, die, and the operating system will close its files and
> release its memory. Then we can go back to using error for determinism
> assertions and exceptions will stop screwing up interfaces.
But try and try_io are very important for some situations (e.g.
implementing robust transactions around third-party code!)
> (Or insert alternative suggestions for maintaining transactional integrity
> while destructively updating data structures).
So far, no one has come up with a silver bullet. It may be a good topic
for a PhD...
- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list