Contracts for Higher-Order Functions

被引:0
|
作者
Findler, Robert Bruce [1 ]
Felleisen, Matthias [1 ]
机构
[1] Northeastern Univ, Coll Comp Sci, Boston, MA 02115 USA
关键词
Design; Languages; Reliability; Contracts; Higher-order Functions; Behavioral Specifications; Predicate Typing; Software Reliability; SPECIFICATION; LANGUAGE; SCHEME;
D O I
10.1145/2502508.2502521
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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 lambda(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.
引用
收藏
页码:34 / 45
页数:12
相关论文
共 50 条
  • [41] Green functions of higher-order differential operators
    Avramidi, IG
    [J]. JOURNAL OF MATHEMATICAL PHYSICS, 1998, 39 (05) : 2889 - 2909
  • [42] HIGHER-ORDER COHERENCE FUNCTIONS OF PHASE STATES
    NATH, R
    KUMAR, P
    [J]. OPTICS COMMUNICATIONS, 1990, 76 (01) : 51 - 52
  • [43] Subordination for Higher-Order Derivatives of Multivalent Functions
    Rosihan M. Ali
    Abeer O. Badghaish
    V. Ravichandran
    [J]. Journal of Inequalities and Applications, 2008
  • [44] A NOTE ON HIGHER-ORDER TRANSFER-FUNCTIONS
    FRANK, WA
    [J]. MECHANICAL SYSTEMS AND SIGNAL PROCESSING, 1994, 8 (01) : 109 - 111
  • [45] Plan Composition Using Higher-Order Functions
    Rivera, Elijah
    Krishnamurthi, Shriram
    Goldstone, Robert
    [J]. PROCEEDINGS OF THE 2022 ACM CONFERENCE ON INTERNATIONAL COMPUTING EDUCATION RESEARCH, ICER 2022, VOL. 1, 2023, : 84 - 104
  • [46] ANALYTIC CONTINUATIONS OF HIGHER-ORDER HYPERGEOMETRIC FUNCTIONS
    OLSSON, POM
    [J]. JOURNAL OF MATHEMATICAL PHYSICS, 1966, 7 (04) : 702 - &
  • [47] Model-Checking Higher-Order Functions
    Kobayashi, Naoki
    [J]. PPDP'09: PROCEEDINGS OF THE 11TH INTERNATIONAL ACM SIGPLAN SYMPOSIUM ON PRINCIPLES AND PRACTICE OF DECLARATIVE PROGRAMMING, 2009, : 25 - 36
  • [48] UNIQUENESS PROPERTIES OF HIGHER-ORDER AUTOCORRELATION FUNCTIONS
    YELLOTT, JI
    IVERSON, GJ
    [J]. JOURNAL OF THE OPTICAL SOCIETY OF AMERICA A-OPTICS IMAGE SCIENCE AND VISION, 1992, 9 (03): : 388 - 404
  • [49] Proving and disproving termination of higher-order functions
    Giesl, J
    Thiemann, R
    Schneider-Kamp, P
    [J]. FRONTIERS OF COMBINING SYSTEMS, PROCEEDINGS, 2005, 3717 : 216 - 231
  • [50] Higher-order basis functions for MoM calculations
    Eastwood, J. W.
    Morgan, J. G.
    [J]. IET SCIENCE MEASUREMENT & TECHNOLOGY, 2008, 2 (06) : 379 - 386