skip to main content
research-article

Confined gradual typing

Published:15 October 2014Publication History
Skip Abstract Section

Abstract

Gradual typing combines static and dynamic typing flexibly and safely in a single programming language. To do so, gradually typed languages implicitly insert casts where needed, to ensure at runtime that typing assumptions are not violated by untyped code. However, the implicit nature of cast insertion, especially on higher-order values, can jeopardize reliability and efficiency: higher-order casts can fail at any time, and are costly to execute. We propose Confined Gradual Typing, which extends gradual typing with two new type qualifiers that let programmers control the flow of values between the typed and the untyped worlds, and thereby trade some flexibility for more reliability and performance. We formally develop two variants of Confined Gradual Typing that capture different flexibility/guarantee tradeoffs. We report on the implementation of Confined Gradual Typing in Gradualtalk, a gradually-typed Smalltalk, which confirms the performance advantage of avoiding unwanted higher-order casts and the low overhead of the approach.

References

  1. E. Allende, O. Callaú, J. Fabry, É. Tanter, and M. Denker. Gradual typing for Smalltalk. Science of Computer Programming, Aug. 2013. Available online.Google ScholarGoogle Scholar
  2. E. Allende, J. Fabry, and É. Tanter. Cast insertion strategies for gradually-typed objects. In Proceedings of the 9th ACM Dynamic Languages Symposium (DLS 2013), pages 27--36, Indianapolis, IN, USA, Oct. 2013. ACM Press. ACM SIGPLAN Notices, 49(2). Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. E. Allende, J. Fabry, R. Garcia, and É. Tanter. Confined gradual typing -- extended version with detailed proofs. Technical Report TR/DCC-2014--3, University of Chile, May 2014.Google ScholarGoogle Scholar
  4. B. Bloom, J. Field, N. Nystrom, J. Östlund, G. Richards, R. Strnisa, J. Vitek, and T. Wrigstad. Thorn: robust, concurrent, extensible scripting on the JVM. In Proceedings of the 24th ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2009), pages 117--136, Orlando, Florida, USA, Oct. 2009. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. G. Bracha. Pluggable type systems. In OOPSLA Workshop on Revival of Dynamic Languages, pages 1--6, 2004.Google ScholarGoogle Scholar
  6. G. Bracha and D. Griswold. Strongtalk: Typechecking Smalltalk in a production environment. In Proceedings of the 8th International Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 95), pages 215--230, Washington, D.C., USA, Oct. 1993. ACM Press. ACM SIGPLAN Notices, 28(10). Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R. Cartwright and M. Fagan. Soft typing. In Proceedings of the ACM SIGPLAN International Conference on Programming Language Design and Implementation (PLDI), pages 278--292, Toronto, Ontario, Canada, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. G. Castagna, editor. Proceedings of the 18th European Symposium on Programming Languages and Systems (ESOP 2009), volume 5502 of phLecture Notes in Computer Science, York, UK, 2009. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. R. B. Findler and M. Felleisen. Contracts for higher-order functions. In Proceedings of the 7th ACM SIGPLAN International Conference on Functional Programming, pages 48--59, Pittsburgh, PA, USA, 2002. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Furr. Combining Static and Dynamic Typing in Ruby. PhD thesis, University of Maryland, 2009.Google ScholarGoogle Scholar
  11. D. Grossman, G. Morrisett, and S. Zdancewic. Syntactic type abstraction. ACM Transactions on Programming Languages and Systems, 22 (6): 1037--1080, Nov. 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. D. Herman, A. Tomb, and C. Flanagan. Space-efficient gradual typing. Higher-Order and Sympolic Computation, 23 (2): 167--189, June 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. L. Ina and A. Igarashi. Gradual typing for generics. In Proceedings of the 26th ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2011), pages 609--624, Portland, Oregon, USA, Oct. 2011. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. K. Knowles and C. Flanagan. Hybrid type checking. ACM Transactions on Programming Languages and Systems, 32 (2): Article n.6, Jan. 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. J. Matthews and R. B. Findler. Operational semantics for multi-language programs. In Proceedings of the 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2007), pages 3--10, Nice, France, Jan. 2007. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. POPL 2010. Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages (POPL 2010), Madrid, Spain, Jan. 2010. ACM Press.Google ScholarGoogle Scholar
  17. A. Rastogi, A. Chaudhuri, and B. Hosmer. The ins and outs of gradual type inference. In Proceedings of the 39th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages (POPL 2012), pages 481--494, Philadelphia, USA, Jan. 2012. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. B. V. Ryseghem, S. Ducasse, and J. Fabry. Seamless composition and reuse of customizable user interfaces with Spec. Science of Computer Programming, 2014. To appear.Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. J. Siek and W. Taha. Gradual typing for functional languages. In Proceedings of the Scheme and Functional Programming Workshop, pages 81--92, Sept. 2006.Google ScholarGoogle Scholar
  20. J. Siek and W. Taha. Gradual typing for objects. In E. Ernst, editor, Proceedings of the 21st European Conference on Object-oriented Programming (ECOOP 2007), number 4609 in Lecture Notes in Computer Science, pages 2--27, Berlin, Germany, July 2007. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. J. Siek and P. Wadler. Threesomes, with and without blame. Incitetpopl2010, pages 365--376. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. J. Siek, R. Garcia, and W. Taha. Exploring the design space of higher-order casts. Incitetesop2009, pages 17--31. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. N. Swamy, C. Fournet, A. Rastogi, K. Bhargavan, J. Chen, P.-Y. Strub, and G. Bierman. Gradual typing embedded securely in JavaScript. In Proceedings of the 41st ACM SIGPLAN-SIGACT symposium on Principles of programming languages (POPL 2014), pages 425--437, San Diego, CA, USA, Jan. 2014. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. A. Takikawa, T. S. Strickland, C. Dimoulas, S. Tobin-Hochstadt, and M. Felleisen. Gradual typing for first-class classes. In Proceedings of the 27th ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2012), pages 793--810, Tucson, AZ, USA, Oct. 2012. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. S. Tobin-Hochstadt. Typed Scheme: From Scripts to Programs. PhD thesis, Northeastern University, Jan. 2010.Google ScholarGoogle Scholar
  26. S. Tobin-Hochstadt and M. Felleisen. Interlanguage migration: from scripts to programs. In Proceedings of the ACM Dynamic Languages Symposium (DLS 2006), pages 964--974, Portland, Oregon, USA, Oct. 2006. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. P. Wadler and R. B. Findler. Well-typed programs can't be blamed. Incitetesop2009, pages 1--16. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. T. Wrigstad, F. Zappa Nardelli, S. Lebresne, J. Östlund, and J. Vitek. Integrating typed and untyped code in a scripting language. Incitetpopl2010, pages 377--388. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Confined gradual typing

    Recommendations

    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 49, Issue 10
      OOPSLA '14
      October 2014
      907 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2714064
      • Editor:
      • Andy Gill
      Issue’s Table of Contents
      • cover image ACM Conferences
        OOPSLA '14: Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications
        October 2014
        946 pages
        ISBN:9781450325851
        DOI:10.1145/2660193

      Copyright © 2014 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 15 October 2014

      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!