research-article

Blame for all

Published:26 January 2011Publication History

Abstract

Several programming languages are beginning to integrate static and dynamic typing, including Racket (formerly PLT Scheme), Perl 6, and C# 4.0 and the research languages Sage (Gronski, Knowles, Tomb, Freund, and Flanagan, 2006) and Thorn (Wrigstad, Eugster, Field, Nystrom, and Vitek, 2009). However, an important open question remains, which is how to add parametric polymorphism to languages that combine static and dynamic typing. We present a system that permits a value of dynamic type to be cast to a polymorphic type and vice versa, with relational parametricity enforced by a kind of dynamic sealing along the lines proposed by Matthews and Ahmed (2008) and Neis, Dreyer, and Rossberg (2009). Our system includes a notion of blame, which allows us to show that when casting between a more-precise type and a less-precise type, any cast failures are due to the less-precisely-typed portion of the program. We also show that a cast from a subtype to its supertype cannot fail.

Supplemental Material

18-mpeg-4.mp4

References

  1. Martin Abadi, Luca Cardelli, Benjamin Pierce, and Gordon Plotkin. Dynamic typing in a statically typed language. ACM Transactions on Programming Languages and Systems, 13 (2): 237--268, April 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Amal Ahmed, Jacob Matthews, Robert Bruce Findler, and Philip Wadler. Blame for all. In Workshop on Script-to-Program Evolution (STOP), pages 1--13, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Robert Bruce Findler and Matthias Felleisen. Contracts for higher-order functions. In ACM International Conference on Functional Programming (ICFP), pages 48--59, October 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Andrew Gill, John Launchbury, and Simon L. Peyton Jones. A short cut to deforestation. In ACM Conference on Functional Programming Languages and Computer Architecture (FPCA), pages 223--232, September 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Jessica Gronski, Kenneth Knowles, Aaron Tomb, Stephen N. Freund, and Cormac Flanagan. Sage: Hybrid checking for flexible specifications. In Scheme and Functional Programming Workshop (Scheme), pages 93--104, September 2006.Google ScholarGoogle Scholar
  6. Dan Grossman, Greg Morrisett, and Steve Zdancewic. Syntactic type abstraction. ACM Transactions on Programming Languages and Systems, 22 (6): 1037--1080, November 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Arjun Guha, Jacob Matthews, Robert Bruce Findler, and Shriram Krishnamurthi. Relationally-parametric polymorphic contracts. In Dynamic Languages Symposium (DLS), pages 29--40, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Robert Harper. Practical Foundations for Programming Languages. 2007. Working Draft.Google ScholarGoogle Scholar
  9. Fritz Henglein. Dynamic typing: Syntax and proof theory. Science of Computer Programming, 22 (3): 197--230, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Jacob Matthews and Amal Ahmed. Parametric polymorphism through run-time sealing. In European Symposium on Programming (ESOP), pages 16--31, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Jacob Matthews and Robert Bruce Findler. Operational semantics for multi-language programs. In ACM Symposium on Principles of Programming Languages (POPL), pages 3--10, January 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. James H. Morris, Jr. Types are not sets. In ACM Symposium on Principles of Programming Languages (POPL), pages 120--124, October 1973. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Georg Neis, Derek Dreyer, and Andreas Rossberg. Non-parametric parametricity. In ACM International Conference on Functional Programming (ICFP), pages 135--148, September 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Xinming Ou, Gang Tan, Yitzhak Mandelbaum, and David Walker. Dynamic typing with dependent types. In IFIP International Conference on Theoretical Computer Science, pages 437--450, August 2004.Google ScholarGoogle ScholarCross RefCross Ref
  15. Benjamin Pierce and Eijiro Sumii. Relating cryptography and polymorphism. Manuscript, 2000. URL www.cis.upenn.edu/ bcpierce/papers/infohide.ps.Google ScholarGoogle Scholar
  16. John Reynolds. Types, abstraction, and parametric polymorphism. In R. E. A. Mason, editor, Information Processing, pages 513--523. North-Holland, 1983.Google ScholarGoogle Scholar
  17. Andreas Rossberg. Generativity and dynamic opacity for abstract types. In ACM Conference on Principles and Practice of Declarative Programming (PPDP), pages 241--252, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Jeremy G. Siek and Walid Taha. Gradual typing for functional languages. In Scheme and Functional Programming Workshop (Scheme), pages 81--92, September 2006.Google ScholarGoogle Scholar
  19. Martin Sulzmann, Manuel M. T. Chakravarty, Simon Peyton Jones, and Kevin Donnelly. System F with type equality coercions. In ACM Workshop on Types in Languages Design and Implementation (TLDI), pages 53--66, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Satish Thatte. Type inference with partial types. In International Colloquium on Automata, Languages and Programming (ICALP), volume 317 of phLecture Notes in Computer Science, pages 615--629. Springer-Verlag, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Sam Tobin-Hochstadt and Matthias Felleisen. Interlanguage migration: From scripts to programs. In Dynamic Languages Symposium (DLS), pages 964--974, October 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Philip Wadler and Robert Bruce Findler. Well-typed programs can't be blamed. In European Symposium on Programming (ESOP), pages 1--16, March 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Andrew K. Wright. Simple imperative polymorphism. Higher-Order and Symbolic Computation, 8 (4): 343--355, Dec. 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Tobias Wrigstad, Francesco Zappa Nardelli, Sylvain Lebresne, Johan Östlund, and Jan Vitek. Integrating typed and untyped code in a scripting language. In ACM Symposium on Principles of Programming Languages (POPL), pages 377--388, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Blame for all

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 46, Issue 1
      POPL '11
      January 2011
      624 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1925844
      Issue’s Table of Contents
      • cover image ACM Conferences
        POPL '11: Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
        January 2011
        652 pages
        ISBN:9781450304900
        DOI:10.1145/1926385

      Copyright © 2011 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 26 January 2011

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!