Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1297081.1297089acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
Article

Relationally-parametric polymorphic contracts

Published: 22 October 2007 Publication History
  • Get Citation Alerts
  • Abstract

    The analogy between types and contracts raises the question of how many features of static type systems can be expressed as dynamic contracts. An important feature missing in prior work on contracts is parametricity, as represented by the polymorphic types in languages like Standard ML.
    We present a contract counterpart to parametricity. We explore multiple designs for such a system and present one that is simple and incurs minimal execution overhead. We show how to extend the notion of contract blame to our definition. We present a form of inference that can often save programmers from having to explicitly instantiate many parametric contracts. Finally, we present several examples that illustrate how this system mimics the feel and properties of parametric polymorphism in typed languages.

    References

    [1]
    Carrillo-Castellon, M., J. Garcia-Molina, E. Pimentel and I. Repiso. Design by contract in Smalltalk. Journal of Object-Oriented Programming, 7(9):23--28, 1996.
    [2]
    Conway, D. and C. G. Goebel. Class::Contract -- design-bycontract OO in Perl. search.cpan.org/?ggoebel/Class-Contract-1.14.
    [3]
    ECMA. ECMAScript language specification.
    [4]
    Elliot, C. and P. Hudak. Functional reactive animation. In ACM SIGPLAN International Conference on Functional Programming, pages 163--173, June 1997.
    [5]
    Findler, Barzilay, Blume, Codik, Felleisen, Flatt, Huang, Matthews, McCarthy, Scott, Press, Rainey, Reppy, Riehl, Spiro, Tucker and Wick. The eighth annual ICFP programming contest. icfpc.plt-scheme.org/.
    [6]
    Findler, R. and M. Felleisen. Contracts for higher-order functions. In ACM SIGPLAN International Conference on Functional Programming, pages 48--59, 2002.
    [7]
    Findler, R. B. and M. Blume. Contracts as pairs of projections. In International Symposium on Functional and Logic Programming, pages 226--241, 2006.
    [8]
    Findler, R. B., M. Latendresse and M. Felleisen. Behavioral contracts and behavioral subtyping. In Proceedings of ACM Conference Foundations of Software Engineering, pages 229--236, 2001.
    [9]
    Flapjax Team. Flapjax programming language. www.flapjax-lang.org.
    [10]
    Flatt, M. Composable and compilable macros: You want it when? In ACM SIGPLAN International Conference on Functional Programming, pages 72--83, 2002.
    [11]
    Harper, R. and G. Morrisett. Compiling polymorphism using intensional type analysis. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 130--141, 1994.
    [12]
    Hinze, R., J. Jeuring and A. Löh. Typed contracts for functional programming. In International Symposium on Functional and Logic Programming, pages 208--225, 2006.
    [13]
    Ignatoff, D., G. H. Cooper and S. Krishnamurthi. Crossing state lines: Adapting object-oriented frameworks to functional reactive languages. In International Symposium on Functional and Logic Programming, pages 259--276, 2006.
    [14]
    Karaorman, M., U. Hölzle and J. Bruno. jContractor: A reflective Java library to support design by contract. In Proceedings of Meta-Level Architectures and Reflection, volume 1616 of LNCS, July 1999.
    [15]
    Matthews, J. and R. B. Findler. Operational semantics for multi-language programs. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 3--10, 2007.
    [16]
    McFarlane, K. Design by contract framework. www.codeproject.com/csharp/designbycontract.asp.
    [17]
    Meyer, B. Eiffel: The Language. Prentice Hall, 1992.
    [18]
    Milner, R. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17:348--375, August 1978.
    [19]
    Milner, R., M. Tofte and R. Harper. The Definition of Standard ML. MIT Press, Cambridge, MA, 1990.
    [20]
    Mitchell, J. C. and G. D. Plotkin. Abstract types have existential type. ACM Transactions on Programming Languages and Systems, 10(3):470--502, 1988.
    [21]
    Pierce, B. and E. Sumii. Relating cryptography and polymorphism, 2000. Unpublished manuscript.
    [22]
    Plösch, R. Design by contract for Python. In IEEE Proceedings of the Joint Asia Pacific Software Engineering Conference, page 213, 1997.
    [23]
    Plösch, R. and J. Pichler. Contracts: From analysis to C++ implementation. In Technology of Object-Oriented Languages and Systems, pages 248--257, 1999.
    [24]
    PLT. PLT MzLib: Libraries manual. Technical Report PLTTR05-4-v300, PLT Scheme Inc., 2005. www.plt-scheme.org/techreports/.
    [25]
    Reynolds, J. C. Types, absraction, and parametric polymorphism. In Information Processing 83, pages 513--523, 1983.
    [26]
    Rosenblum, D. S. A practical approach to programming with assertions. IEEE Transactions on Software Engineering, 21(1):19--31, January 1995.
    [27]
    Tobin-Hochstadt, S. and M. Felleisen. Interlanguage migration: from scripts to programs. In Object-Oriented Programming Systems, Languages, and Applications, pages 964--974, 2006.
    [28]
    Wadler, P. Theorems for free! In International Conference on Functional Programming Languages and Computer Architecture, pages 347--359, 1989.
    [29]
    Zdancewic, S., D. Grossman and G. Morrisett. Principals in programming languages: a syntactic proof technique. In International Conference on Functional Programming, pages 197--207, 1999.

    Cited By

    View all
    • (2022)Gradual System FJournal of the ACM10.1145/355598669:5(1-78)Online publication date: 28-Oct-2022
    • (2022)Two Parametricities Versus Three Universal TypesACM Transactions on Programming Languages and Systems10.1145/353965744:4(1-43)Online publication date: 21-Sep-2022
    • (2022)Deep and shallow types for gradual languagesProceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3519939.3523430(580-593)Online publication date: 9-Jun-2022
    • Show More Cited By

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    DLS '07: Proceedings of the 2007 symposium on Dynamic languages
    October 2007
    108 pages
    ISBN:9781595938688
    DOI:10.1145/1297081
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 22 October 2007

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. contracts
    2. parametricity
    3. polymorphism

    Qualifiers

    • Article

    Conference

    OOPSLA07
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 32 of 77 submissions, 42%

    Upcoming Conference

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)7
    • Downloads (Last 6 weeks)1

    Other Metrics

    Citations

    Cited By

    View all
    • (2022)Gradual System FJournal of the ACM10.1145/355598669:5(1-78)Online publication date: 28-Oct-2022
    • (2022)Two Parametricities Versus Three Universal TypesACM Transactions on Programming Languages and Systems10.1145/353965744:4(1-43)Online publication date: 21-Sep-2022
    • (2022)Deep and shallow types for gradual languagesProceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3519939.3523430(580-593)Online publication date: 9-Jun-2022
    • (2022)Migrating gradual typesJournal of Functional Programming10.1017/S095679682200008932Online publication date: 6-Oct-2022
    • (2021)GATE: Gradual Effect TypesLeveraging Applications of Formal Methods, Verification and Validation10.1007/978-3-030-89159-6_21(335-345)Online publication date: 12-Oct-2021
    • (2019)Toward efficient gradual typing for structural types via coercionsProceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3314221.3314627(517-532)Online publication date: 8-Jun-2019
    • (2019)Gradual parametricity, revisitedProceedings of the ACM on Programming Languages10.1145/32903303:POPL(1-30)Online publication date: 2-Jan-2019
    • (2018)The root cause of blame: contracts for intersection and union typesProceedings of the ACM on Programming Languages10.1145/32765042:OOPSLA(1-29)Online publication date: 24-Oct-2018
    • (2018)An extended account of contract monitoring strategies as patterns of communicationJournal of Functional Programming10.1017/S095679681800004728Online publication date: 7-Mar-2018
    • (2017)Parametricity versus the universal typeProceedings of the ACM on Programming Languages10.1145/31581262:POPL(1-23)Online publication date: 27-Dec-2017
    • Show More Cited By

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media