Integrating support for undo with exception handling by Avraham Shinnar; David Tarditi; Mark Plesko and Bjarne Steensgaard.
This paper appears to have as its object a solution to similar problems as those addressed by software transactional memory, i.e. maintaining memory consistency. Where STM provides transactions that can be used to implement multi-threaded programmes much more simply that traditional explicit locking approaches, this paper uses a similar mechanism to handle unexpected failures (uncaught exceptions) and roll-back the effects of the failed code.
The authors describe their implementation of an undo mechanism in
Bartok, an experimental optimising C#
compiler and CIL
runtime. Their system extends C# with
a try_all
block which acts as a catch-all exception
handler. If an exception propagates is raised within a
try_all
block and is not handled before it reaches the
scope of the block, then the roll-back mechanism is engaged.
The main difference between Haskell’s STM is the goal: where STM is concerned with maintaining memory consistency in the face of concurrently executing threads, this system is concerned with simplifying error handling and recovery.