10.1145/1706299.1706342acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Threesomes, with and without blame

Published:17 January 2010Publication History

ABSTRACT

How to integrate static and dynamic types? Recent work focuses on casts to mediate between the two. However, adding casts may degrade tail calls into a non-tail calls, increasing space consumption from constant to linear in the depth of calls.

We present a new solution to this old problem, based on the notion of a threesome. A cast is specified by a source and a target type--a twosome. Any twosome factors into a downcast from the source to an intermediate type, followed by an upcast from the intermediate to the target---a threesome. Any chain of threesomes collapses to a single threesome, calculated by taking the greatest lower bound of the intermediate types. We augment this solution with blame labels to map any failure of a threesome back to the offending twosome in the source program.

Herman, Tomb, and Flanagan (2007) solve the space problem by representing casts with the coercion calculus of Henglein (1994). While they provide a theoretical limit on the space overhead, there remains the practical question of how best to implement coercion reduction. The threesomes presented in this paper provide a streamlined data structure and algorithm for representing and normalizing coercions. Furthermore, threesomes provide a typed-based explanation of coercion reduction.

References

  1. M. Abadi, L. Cardelli, B. Pierce, and G. Plotkin. Dynamic typing in a statically-typed language. In POPL '89: Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 213--227, New York, NY, USA, 1989. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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
  3. V. Breazu--Tannen, T. Coquand, C. Gunter, and A. Scedrov. Inheritance and explicit coercion. In Proceedings of the Fourth Annual Symposium on Logic in computer science, pages 112--129, Piscataway, NJ, USA, 1989. IEEE Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. L. Cardelli, J. Donahue, M. Jordan, B. Kalsow, and G. Nelson. The modula-3 type system. In POPL '89: Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 202--212, New York, NY, USA, 1989. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Luca Cardelli. Amber. In Combinators and Functional Programming Languages, volume 242, pages 21--70, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. R.B. Findler and M. Felleisen. Contracts for higher-order functions. In ACM International Conference on Functional Programming, October 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Cormac Flanagan. Hybrid type checking. In POPL 2006: The 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 245--256, Charleston, South Carolina, January 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Cormac Flanagan, Stephen N. Freund, and Aaron Tomb. Hybrid types, invariants, and refnements for imperative objects. In FOOL/WOOD '06: International Workshop on Foundations and Developments of Object-Oriented Languages, 2006.Google ScholarGoogle Scholar
  9. Kathryn E. Gray, Robert Bruce Findler, and Matthew Flatt. Fine-interoperability through mirrors and contracts. In OOPSLA '05: Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming systems languages and applications, pages 231--245, New York, NY, USA, 2005. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Jessica Gronski and Cormac Flanagan. Unifying hybrid types and contracts. In Trends in Functional Prog. (TFP), 2007.Google ScholarGoogle Scholar
  11. Jessica Gronski, Kenneth Knowles, Aaron Tomb, Stephen N. Freund, and Cormac Flanagan. Sage: Hybrid checking for flexible specifcations. In Scheme and Functional Programming Workshop, pages 93--104, 2006.Google ScholarGoogle Scholar
  12. Lars T. Hansen. Evolutionary programming and gradual typing in ECMAScript 4 (tutorial). Technical report, ECMA TG1 working group, November 2007.Google ScholarGoogle Scholar
  13. Anders Hejlsberg. The future of C#. http://channel9.msdn.com/pdc2008/TL16/, October 2008.Google ScholarGoogle Scholar
  14. Fritz Henglein. Dynamic typing. In ESOP '92: Proceedings of the 4th European Symposium on Programming, pages 233--253, London, UK, 1992. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Fritz Henglein. Dynamic typing: syntax and proof theory. Science of Computer Programming, 22(3):197--230, June 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. David Herman, Aaron Tomb, and Cormac Flanagan. Space-effcient gradual typing. In Trends in Functional Prog. (TFP), page XXVIII, April 2007.Google ScholarGoogle Scholar
  17. Butler W. Lampson. A description of the Cedar language. Technical report, Xerox PARC, 1983.Google ScholarGoogle Scholar
  18. Barbara Liskov, Russ Atkinson, Toby Bloom, Eliot Moss, Craig Schaffert, Bob Scheifler, and Alan Snyder. CLU reference manual. Technical Report LCS-TR-225, MIT, October 1979. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. John C. Mitchell. Coercion and type inference. In POPL '84: Proceedings of the 11th ACM SIGACT-SIGPLAN symposium on Principles of programming languages, pages 175--185, New York, NY, USA, 1984. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. P. Rovner. Extending Modula-2 to build large, integrated systems. IEEE Software, 3(6):46--57, 1986. ISSN 0740-7459. doi: http://doi.ieeecomputersociety.org/10.1109/MS.1986.229476. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Dana Scott. Data types as lattices. SIAM Journal on Computing, 5(3): 522--587, 1976.Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Jeremy G. Siek and Walid Taha. Gradual typing for functional languages. In Scheme and Functional Programming Workshop, pages 81--92, September 2006.Google ScholarGoogle Scholar
  23. Jeremy G. Siek and Walid Taha. Gradual typing for objects. In ECOOP 2007, volume 4609 of LCNS, pages 2--27. Springer Verlag, August 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Jeremy G. Siek, Ronald Garcia, and Walid Taha. Exploring the design space of higher-order casts. In European Symposium on Programming, March 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Satish Thatte. Quasi-static typing. In POPL 1990, pages 367--381, New York, NY, USA, 1990. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Sam Tobin-Hochstadt and Matthias Felleisen. Interlanguage migration: From scripts to programs. In OOPSLA'06 Companion, pages 964--974, NY, 2006. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Sam Tobin-Hochstadt and Matthias Felleisen. The design and implementation of Typed Scheme. In POPL 2008: The 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, January 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Philip Wadler and Robert Bruce Findler. Well-typed programs can't be blamed. In Workshop on Scheme and Functional Programming, pages 15--26, 2007.Google ScholarGoogle Scholar
  29. Philip Wadler and Robert Bruce Findler. Well-typed programs can't be blamed. In European Symposium on Programming, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Larry Wall. Synopsis 2: Bits and pieces. Technical report, June 2009.Google ScholarGoogle Scholar
  31. Tobias Wrigstad, Patrick Eugster, John Field, Nate Nystrom, and Jan Vitek. Software hardening: A research agenda. In International Workshop on Script to Program Evolution, July 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Threesomes, with and without blame

    Comments

    Login options

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

    Sign in
    • Published in

      cover image ACM Conferences
      POPL '10: Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
      January 2010
      520 pages
      ISBN:9781605584799
      DOI:10.1145/1706299
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 45, Issue 1
        POPL '10
        January 2010
        500 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1707801
        Issue’s Table of Contents

      Copyright © 2010 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 17 January 2010

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate 770 of 3,892 submissions, 20%

    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!