ABSTRACT

Many programming languages involve global exit constructs. For example, Common Lisp (Steele 1990) provides the control construct catch and throw. If the current control of a program goes beyond normal processing and a file handle is already open there, then the file handler should be closed after exiting. The following is a sample code of Common Lisp

(catch ‘exit (let ((port (open “/tmp/data.csv”))) (unwind-protect (read-csv port) (close port)))) (define read-csv (file-handle) …) The variable port is bound to a file handle, and

the procedure read-csv is assumed to read CSV data from the file, and if an error such as a malformed CSV occurs, an exception exit is thrown. The special operator unwind-protect captures the global exit of the exception and executes (close port) which closes the file handle.