15-212: Principles of Programming

Lecture 13: Exceptions

Exceptions play an important role in the system of static and dynamic checks that make SML a safe language. Exceptions are the first type of effect that we will encounter; they may cause an evaluation to be interrupted or aborted. We have already seen simple uses of exceptions in the course, primarily to signal that invariants are violated or exceptional boundary cases are encountered. We now look a little more closely at what exceptions are and how they can be used. In addition to signalling error conditions, exceptions can sometimes also be used in backtracking search procedures or other patterns of control where a computation needs to be partially undone.

Key Concepts

Sample Code

On-line Notes by Robert Harper

Suggested Reading in Programming in Standard ML:

[ CS 15-212 Home page | schedule | language | assignments | handouts ]

Michael Erdmann