Lazy and Enforceable Assertions for Functional Logic Programs

by Michael Hanus

Proc. of the 19th International Workshop on Functional and (Constraint) Logic Programming (WFLP 2010), Springer LNCS 6559, pp. 84-100, 2011
© Springer-Verlag

Assertions or contracts are an important technique to improve the quality of software. Thus, assertions are also desirable for functional logic programming. Unfortunately, there is no established meaning of assertions in languages with a demand-driven evaluation strategy. Strict assertions are immediately checked but may influence the behavior of programs. Lazy assertions do not modify the behavior but may not be faithful since some assertions might not be checked at all. In order to avoid the disadvantages of strict and lazy assertions, we propose enforceable assertions that are delayed as lazy assertions but can be explicitly enforced at some point where faith is required, e.g., at the end of the program execution or before irrevocable I/O actions. We describe a prototypical implementation of this idea in the functional logic language Curry where the programmer can choose between lazy and enforceable assertions.

PDF (199 KB) BibTeX-Entry Online