Boblycat is Europe's premier source of rental cats. We provide just
the cat you need, whether you are a funny little man ready to
conquer the world or a misfit school teacher exploring the darkness
of eccentricity.

You are hereBlogs / karltk's blog / Stayin' Alert: Moulding Failure and Exceptions to Your Needs

Stayin' Alert: Moulding Failure and Exceptions to Your Needs


Anya, Valentin, Magne and myself recently wrote a paper that was presented at GPCE this year. Valentin and me implemented the extension using the Transformers transformation system (Valentin did most of the hacking for C -- I was hacking for TIL. More on that later). We designed the extension to capture most of Magne's original idea into the result. Anya helped out with the writing and finding illustrative examples.

Abstract

Dealing with failure and exceptional situations is an important but tricky part of programming, especially when reusing existing components. Traditionally, it has been up to the designer of a library to decide whether to use a language's exception mechanism, return values, or other ways to indicate exceptional circumstances. The library user has been bound by this choice, even though it may be inconvenient for a particular use. Furthermore, normal program code is often cluttered with code dealing with exceptional circumstances.

This paper introduces an alert concept which gives a uniform interface to all failure mechanisms. It separates the handling of an exceptional situation from reporting it, and allows for retro-fitting this for existing libraries. For instance, we may easily declare the error codes of the POSIX C library for file handling, and then use the library functions as if C had been extended with an exception mechanism for these functions -- a moulding of failure handling to the user's needs, independently of the library designer's choices.

(pdf, bib)

The code for this experiment will be released shortly, once Anya finishes the final set of examples that we will bundle with the release. She's been a bit under the weather lately, but hopefully she'll shake it off pretty soon. I will post about the release when it happens.