Affiliation:
1. Northeastern University, Boston, MA
Abstract
Assertions play an important role in the construction of robust software. Their use in programming languages dates back to the 1970s. Eiffel, an object-oriented programming language, wholeheartedly adopted assertions and developed the "Design by Contract" philosophy. Indeed, the entire object-oriented community recognizes the value of assertion-based contracts on methods.In contrast, languages with higher-order functions do not support assertion-based contracts. Because predicates on functions are, in general, undecidable, specifying such predicates appears to be meaningless. Instead, the functional languages community developed type systems that statically approximate interesting predicates.In this paper, we show how to support higher-order function contracts in a theoretically well-founded and practically viable manner. Specifically, we introduce λ
con
, a typed lambda calculus with assertions for higher-order functions. The calculus models the assertion monitoring system that we employ in DrScheme. We establish basic properties of the model (type soundness, etc.) and illustrate the usefulness of contract checking with examples from DrScheme's code base.We believe that the development of an assertion system for higher-order functions serves two purposes. On one hand, the system has strong practical potential because existing type systems simply cannot express many assertions that programmers would like to state. On the other hand, an inspection of a large base of invariants may provide inspiration for the direction of practical future type system research.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Reference31 articles.
1. AT&T Bell Labratories. Standard ML of New Jersey 1993.]] AT&T Bell Labratories. Standard ML of New Jersey 1993.]]
2. Proper tail recursion and space efficiency
3. The revised report on the syntactic theories of sequential control and state
Cited by
150 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Consolidating Smart Contracts with Behavioral Contracts;Proceedings of the ACM on Programming Languages;2024-06-20
2. Effectful Software Contracts;Proceedings of the ACM on Programming Languages;2024-01-05
3. Securing Verified IO Programs Against Unverified Code in F*;Proceedings of the ACM on Programming Languages;2024-01-05
4. Static Blame for gradual typing;Journal of Functional Programming;2024
5. Focusing on Refinement Typing;ACM Transactions on Programming Languages and Systems;2023-12-20