Venari/ML Interfaces and Examples

Transactions are a well-known and fundamental control abstraction that arose from the database community. Application programmers can treat a sequence of operations as an atomic ("all-or-nothing") unit and rely on the runtime environment to guarantee serializability of concurrent transactions and persistence of effects of committed transactions. In this report, we present interfaces, expressed in Standard ML, for creating and controlling transactions. Unlike other transaction-based high-level programming languages such as Argus and Avalon, Venari/ML is the first to support multi-threaded transactions, where each transaction may have multiple threads of control executing within its scope. We present a set of simple examples that show how to use Venari/ML interfaces individually and also in some useful combinations. We also present a larger example of searching a database of BibTeX entries. This report is intended primarily for use by an SML programmer whose application requires transactional properties. Our work on transactions in the context of SML led to our invention of a new control abstraction, called a skein, which is a group of threads that cooperate on a single task. Skeins take as parameters initialization and completion functions; transactions are easily constructed as a special case of skeins. The Venari/ML interfaces are cast in terms of SML''s modules facility. Modules support a separation of concerns, e.g., persistence from undoability, that are often tightly integrated in other transaction-based programming languages. We make extensive use of closures in SML, allowing us at runtime to compose different functions, each of which supports a different feature of transactions.