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

The swiss coercion

Published: 02 October 2007 Publication History

Abstract

Recent type systems allow the programmer to use types that describe more precisely the invariants on which the program relies. But in order to satisfy the type system, it often becomes necessary to help the type checker with extra annotations that justify why a piece of code is indeed well-formed. Such annotations take the form of term-level type manipulations, such as type abstractions, type applications, existential package packing and opening, as well as coercions, or casts. While those operations have no direct runtime cost, they tend to introduce extra runtime operations equivalent to n-redexes or even empty loops in order to get to the point where we can apply that supposedly free operation. We show a coercion that is like a pacific Swiss army knife of coercions: it cannot cut but it can instantiate, open, pack, abstract, analyze, or do any combination thereof, reducing the need for extra surrounding runtime operations. And all that, of course, for the price of a single coercion, which still costs absolutely nothing at runtime. This new coercion is derived from Karl Crary's coercion calculus [Crary, 2000], but can also replace Crary and Weirich's vcase [Crary and Weirich, 1999]. It additionally happens to come in handy to work around some limitations of value polymorphism. It is presented in the context of Shao et al.'s Type System for Certified Binaries [Shao et al., 2002]. Other than the coercion itself, another interesting aspect of this work is a slightly unusual proof technique to show soundness of the type erasure using a pure type assignment language, making the no-op nature of our cast more obvious.

References

[1]
Gregory-D. Collins and Zhong Shao. Intensional analysis of higher-kinded recursive types. Technical Report YALEU/DCS/TR--1240, Yale University, New Haven, CT, 2002.
[2]
Karl Crary. Typed compilation of inclusive subtyping. In International Conference on Functional Programming. ACM Press, September 2000.
[3]
Karl Crary and Stephanie Weirich. Flexible type analysis. In International Conference on Functional Programming, pages 233--248, Paris, France, September 1999. ACM Press.
[4]
Joshua Dunfield and Frank Pfenning. Type assignment for intersections and unions in call-by-value languages. In Conference on Foundations of Software Science and Computation Structures, volume 2620 of Lecture Notes in Computer Science, pages 250--266, April 2003.
[5]
Seth Fogarty, Emir Pašalić, Jeremy Siek, and Walid Taha. Concoqtion: Indexed types now! In Workshop on Partial Evaluation and Semantics-Based Program Manipulation, 2007.
[6]
Robert Harper and Christopher Stone. A type-theoretic interpretation of Standard ML. In Gordon Plotkin, Colin Stirling, and Mads Tofte, editors, Proof, Language and Interaction: Essays in Honour of Robin Milner. MIT Press, 2000. Extended version published as CMU technical report CMU-CS-97-147.
[7]
Chris Hawblitzel, Edward Wei, Heng Huang, Eric Krupski, and Lea Wittie. Low-level linear memory management. In Informal proceedings of the SPACE Workshop, Venice, Italy, January 2004.
[8]
Christopher League and Stefan Monnier. Typed compilation against non-manifest base classes. Lecture Notes in Computer Science, 3956:77--98, January 2006.
[9]
Christopher League, Zhong Shao, and Valery Trifonov. Type-preserving compilation of featherweight java. Transactions on Programming Languages and Systems, 24(2): 112--152, March 2002.
[10]
Yasuhiko Minimide, Greg Morrisett, and Robert Harper. Typed closure conversion. In Symposium on Principles of Programming Languages, pages 271--283. ACM Press, January 1996.
[11]
Stefan Monnier. Typed regions. In Informal proceedings of the SPACE Workshop, Venice, Italy, January 2004.
[12]
Stefan Monnier, Bratin Saha, and Zhong Shao. Principled scavenging. In Symposium on Programming Languages Design and Implementation, pages 81--91, May 2001.
[13]
Greg Morrisett, David Walker, Karl Crary, and Neal Glew. From system F to typed assembly language. In Symposium on Principles of Programming Languages, pages 85--97, January 1998.
[14]
C Paulin-Mohring. Inductive definitions in the system Coq-rules and properties. In MBezem and JGroote, editors, Proc. TLCA. LNCS 664, Springer-Verlag, 1993.
[15]
Frank Pfenning and Conal Elliott. Higher-order abstract syntax. In Symposium on Programming Languages Design and Implementation, pages 199--208, Atlanta, Georgia, June 1988. ACM Press.
[16]
Zhong Shao, Bratin Saha, Valery Trifonov, and Nikolaos Papaspyrou. A type system for certified binaries. In Symposium on Principles of Programming Languages, pages 217--232, January 2002.
[17]
Martin Sulzmann, Manuel MT. Chakravarty, Simon Peyton Jones, and Kevin Donnelly. System f with type equality coercions. In Types in Language Design and Implementation, pages 53--66, Nice, France, January 2007.
[18]
Andrew-K. Wright. Simple imperative polymorphism. Lisp and Symbolic Computation, 8 (4): 343--356, December 1995.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PLPV '07: Proceedings of the 2007 workshop on Programming languages meets program verification
October 2007
76 pages
ISBN:9781595936776
DOI:10.1145/1292597
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: 02 October 2007

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. coercions
  2. compilation
  3. formal methods
  4. type based security

Qualifiers

  • Article

Conference

ICFP07
Sponsor:

Acceptance Rates

PLPV '07 Paper Acceptance Rate 6 of 8 submissions, 75%;
Overall Acceptance Rate 18 of 25 submissions, 72%

Upcoming Conference

POPL '25

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 108
    Total Downloads
  • Downloads (Last 12 months)1
  • Downloads (Last 6 weeks)0
Reflects downloads up to 22 Sep 2024

Other Metrics

Citations

Cited By

View all

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