[mercury-users] Exceptions and unique modes

Peter Schachte schachte at cs.mu.OZ.AU
Tue Mar 6 18:03:52 AEDT 2001


Late reply to an old message...

On Thu, Feb 22, 2001 at 05:58:27AM -0800, Ralph Becket wrote:
> Here's my suggestion; it handles scope naturally.  For now, let's just 
> consider the case of closing open files and releasing locks etc.
[snip]
> Now, when I enter a try block I push a `checkpoint' onto the recovery stack.
> (Each checkpoint is distinct from all other checkpoints.)
> 
> If the try block succeeds then I simply pop the checkpoint and continue.
> If the exception handler is invoked then I simply pop items from the
> recovery stack, freeing up the various resources that have been claimed
> (e.g. closing files and releasing locks), but not freed, between the
> checkpoint being created and the exception being thrown.  Dead easy.

This doesn't solve the problem of getting back the latest state of a
particular unique thingy following an exception in a computation that may
have altered it.  This subsumes the cleanup problem, since if you can get
back the latest state of something after an exception, you can clean it up.
But I don't see how to parlay a nice unwind-protect mechanism like the one
you suggest into the ability to get back the latest state of something.  I
think Peter's suggesting of naming unique things is a nice solution to
this.  If you don't want to call it global variables, then think of it as a
map from some king of identifier to unique things hanging off the io__state.


-- 
Peter Schachte <schachte at cs.mu.OZ.AU>  What use is magic if it can't save a
http://www.cs.mu.oz.au/~schachte/      unicorn? -- Peter S. Beagle, "The
Phone:  +61 3 8344 9166                Last Unicorn" 
Fax:    +61 3 9348 1184                
--------------------------------------------------------------------------
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