skip to main content
10.1145/2784731.2784744acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Elaborating evaluation-order polymorphism

Published: 29 August 2015 Publication History

Abstract

We classify programming languages according to evaluation order: each language fixes one evaluation order as the default, making it transparent to program in that evaluation order, and troublesome to program in the other. This paper develops a type system that is impartial with respect to evaluation order. Evaluation order is implicit in terms, and explicit in types, with by-value and by-name versions of type connectives. A form of intersection type quantifies over evaluation orders, describing code that is agnostic over (that is, polymorphic in) evaluation order. By allowing such generic code, programs can express the by-value and by-name versions of a computation without code duplication. We also formulate a type system that only has by-value connectives, plus a type that generalizes the difference between by-value and by-name connectives: it is either a suspension (by name) or a "no-op" (by value). We show a straightforward encoding of the impartial type system into the more economical one. Then we define an elaboration from the economical language to a call-by-value semantics, and prove that elaborating a well-typed source program, where evaluation order is implicit, produces a well-typed target program where evaluation order is explicit. We also prove a simulation between evaluation of the target program and reductions (either by-value or by-name) in the source program. Finally, we prove that typing, elaboration, and evaluation are faithful to the type annotations given in the source program: if the programmer only writes by-value types, no by-name reductions can occur at run time.

References

[1]
A. Asperti. Integrating strict and lazy evaluation: the λ sl -calculus. In Programming Language Implementation and Logic Programming, volume 456 of LNCS, pages 238–254. Springer, 1990.
[2]
H. Barendregt, M. Coppo, and M. Dezani-Ciancaglini. A filter lambda model and the completeness of type assignment. J. Symbolic Logic, 48(4):931–940, 1983.
[3]
G. Barthe. Implicit coercions in type systems. In Proc. TYPES ’95, volume 1158 of LNCS, pages 1–15, 1996.
[4]
P. Bernays. Review of “Some Properties of Conversion” by Alonzo Church and J.B. Rosser. J. Symbolic Logic, 1:74–75, 1936.
[5]
V. Breazu-Tannen, T. Coquand, C. A. Gunter, and A. Scedrov. Inheritance as implicit coercion. Information and Computation, 93(1):172–221, 1991.
[6]
S. Chang. On the Relationship Between Laziness and Strictness. PhD thesis, Northeastern University, 2014.
[7]
Y. Chen, J. Dunfield, M. A. Hammer, and U. A. Acar. Implicit self-adjusting computation for purely functional programs. J. Functional Programming, 24(1):56–112, 2014.
[8]
M. Coppo, M. Dezani-Ciancaglini, and B. Venneri. Functional characters of solvable terms. Zeitschrift f. math. Logik und Grundlagen d. Math., 27:45–58, 1981.
[9]
R. Davies. Practical Refinement-Type Checking. PhD thesis, Carnegie Mellon University, 2005. CMU-CS-05-110. R. Davies and F. Pfenning. Intersection types and computational effects. In ICFP, pages 198–208, 2000.
[10]
J. Dunfield. Elaborating intersection and union types. J. Functional Programming, 24(2–3):133–165, 2014.
[11]
J. Dunfield. Elaborating evaluation-order polymorphism, 2015. Extended version with appendices. arXiv:1504.07680 {cs.PL}. J. Dunfield and N. R. Krishnaswami. Complete and easy bidirectional typechecking for higher-rank polymorphism. In ICFP, 2013. arXiv:1306.6032 {cs.PL}. J. Dunfield and F. Pfenning. Type assignment for intersections and unions in call-by-value languages. In FoSSaCS, pages 250–266, 2003.
[12]
J. Dunfield and F. Pfenning. Tridirectional typechecking. In Principles of Programming Languages, pages 281–292, 2004.
[13]
T. Freeman and F. Pfenning. Refinement types for ML. In PLDI, pages 268–277, 1991.
[14]
D. P. Friedman and D. S. Wise. CONS should not evaluate its arguments. In ICALP, pages 257–284. Edinburgh Univ. Press, 1976.
[15]
A. Frisch, G. Castagna, and V. Benzaken. Semantic subtyping. In Logic in Computer Science, 2002.
[16]
P. Henderson and J. H. Morris, Jr. A lazy evaluator. In Principles of Programming Languages, pages 95–103. ACM, 1976.
[17]
J. R. Hindley. Types with intersection: An introduction. Formal Aspects of Computing, 4:470–486, 1992.
[18]
D. Leivant. Typing and computational properties of lambda expressions. Theoretical Computer Science, 44(0):51–68, 1986.
[19]
P. B. Levy. Call-by-push-value: A subsuming paradigm. In Typed Lambda Calculi and Applications, pages 228–243. Springer, 1999.
[20]
R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML (Revised). MIT Press, 1997.
[21]
P. Naur et al. Report on the algorithmic language ALGOL 60. Comm. ACM, 3(5):299–314, 1960.
[22]
B. C. Pierce. Types and Programming Languages. MIT Press, 2002.
[23]
B. C. Pierce and D. N. Turner. Local type inference. ACM Trans. Prog. Lang. Systems, 22:1–44, 2000.
[24]
G. Plotkin. Call-by-name, call-by-value, and the lambda calculus. Theoretical Computer Science, 1:125–159, 1975.
[25]
J. C. Reynolds. Design of the programming language Forsythe. Technical Report CMU-CS-96-146, Carnegie Mellon University, 1996.
[26]
N. Swamy, M. Hicks, and G. M. Bierman. A theory of typed coercions and its applications. In ICFP, pages 329–340, 2009.
[27]
P. Wadler, W. Taha, and D. MacQueen. How to add laziness to a strict language without even being odd. In Workshop on Standard ML, 1998. http://homepages.inf.ed.ac.uk/ wadler/papers/lazyinstrict/lazyinstrict.ps. C. Wadsworth. Semantics and Pragmatics of the lambda-Calculus. PhD thesis, University of Oxford, 1971.
[28]
A. Warth. LazyJ: Seamless lazy evaluation in Java. In FOOL, 2007.
[29]
foolwood07.cs.uchicago.edu/program/warth.pdf. R. L. Wexelblat, editor. History of Programming Languages I. ACM, 1981.
[30]
A. K. Wright. Simple imperative polymorphism. Lisp and Symbolic Computation, 8(4):343–355, 1995.
[31]
H. Xi. Dependent Types in Practical Programming. PhD thesis, Carnegie Mellon University, 1998.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming
August 2015
436 pages
ISBN:9781450336697
DOI:10.1145/2784731
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 50, Issue 9
    ICFP '15
    September 2015
    436 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2858949
    • Editor:
    • Andy Gill
    Issue’s Table of Contents
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 the author(s) 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: 29 August 2015

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. evaluation order
  2. intersection types
  3. polymorphism

Qualifiers

  • Research-article

Conference

ICFP'15
Sponsor:

Acceptance Rates

Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)3
  • Downloads (Last 6 weeks)0
Reflects downloads up to 13 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Call-by-Unboxed-ValueProceedings of the ACM on Programming Languages10.1145/36746548:ICFP(845-879)Online publication date: 15-Aug-2024
  • (2021)Bidirectional TypingACM Computing Surveys10.1145/345095254:5(1-38)Online publication date: 25-May-2021
  • (2020)Kinds are calling conventionsProceedings of the ACM on Programming Languages10.1145/34089864:ICFP(1-29)Online publication date: 3-Aug-2020
  • (2017)Levity polymorphismACM SIGPLAN Notices10.1145/3140587.306235752:6(525-539)Online publication date: 14-Jun-2017
  • (2017)Levity polymorphismProceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3062341.3062357(525-539)Online publication date: 14-Jun-2017
  • (2020)Resolution as intersection subtyping via Modus PonensProceedings of the ACM on Programming Languages10.1145/34282744:OOPSLA(1-30)Online publication date: 13-Nov-2020

View Options

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