Zero-Overhead Exception Handling using Metaprogramming

M. Hof, H. Mössenböck, P. Pirkelbauer
Johannes Kepler University Linz
Institute for Practical Computer Science
Altenbergerstr. 69, A-4040 Linz
hof@ssw.uni-linz.ac.at


Abstract

We present a novel approach to exception handling which is based on metaprogramming. Our mechanism does not require language support, imposes no run time overhead to error-free programs, and is easy to implement. Exception handlers are implemented as ordinary procedures. When an exception occurs, the corresponding handler is searched dynamically using the type of the exception as a search criterion. Our implementation was done in the Oberon System but it could be ported to most other systems that support metaprogramming.


Published in Proceedings SOFSEM'97, Milovy, November 1997, Lecture Notes in Computer Science 1338, pp. 423-431, ISSN 0302-9743
Download here.