skip to main content
10.1145/1328438.1328486acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

The design and implementation of typed scheme

Published:07 January 2008Publication History

ABSTRACT

When scripts in untyped languages grow into large programs, maintaining them becomes difficult. A lack of types in typical scripting languages means that programmers must (re)discover critical pieces of design information every time they wish to change a program. This analysis step both slows down the maintenance process and may even introduce mistakes due to the violation of undiscovered invariants.

This paper presents Typed Scheme, an explicitly typed extension of an untyped scripting language. Its type system is based on the novel notion of occurrence typing, which we formalize and mechanically prove sound. The implementation of Typed Scheme additionally borrows elements from a range of approaches, including recursive types, true unions and subtyping, plus polymorphism combined with a modicum of local inference. Initial experiments with the implementation suggest that Typed Scheme naturally accommodates the programming style of the underlying scripting language, at least for the first few thousand lines of ported code.

References

  1. Alexander Aiken, Edward L. Wimmers, and T. K. Lakshman. Soft typing with conditional types. In POPL '94: Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 163--173, New York, NY, USA, 1994. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Roberto Amadio and Luca Cardelli. Subtyping recursive types. In ACM Transactions on Programming Languages and Systems, volume 15, pages 575--631, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Gilad Bracha. Pluggable type systems. In Revival of Dynamic Languages Workshop at OOPSLA 2004, October 2004.Google ScholarGoogle Scholar
  4. Gilad Bracha and David Griswold. Strongtalk: typechecking Smalltalk in a production environment. In OOPSLA '93: Proceedings of the Eighth Annual Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 215--230, New York, NY, USA, 1993. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. R. Cartwright. User-defined data types as an aid to verifying lisp programs. In Third International Colloquium on Automata, Languages and Programming, pages 228--256, 1976.Google ScholarGoogle Scholar
  6. Robert Cartwright and Mike Fagan. Soft typing. In PLDI '91: Proceedings of the ACM SIGPLAN 1991 Conference on Programming Language Design and Implementation, pages 278--292, New York, NY, USA, 1991. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Karl Crary, Stephanie Weirich, and Greg Morrisett. Intensional polymorphism in type-erasure semantics. In ICFP '98: Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming, pages 301--312, New York, NY, USA, 1998. ACM Press. ISBN 1--58113--024--4. doihttp://doi.acm.org/10.1145/289423.289459. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Ryan Culpepper, Sam Tobin-Hochstadt, and Matthew Flatt. Advanced Macrology and the Implementation of Typed Scheme. In Proceedings of the Eighth Workshop on Scheme and Functional Programming, 2007.Google ScholarGoogle Scholar
  9. R. Kent Dybvig and Robert Hieb. A new approach to procedures with variable arity. Lisp and Symbolic Computation: An International Journal, 3 (3), 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Hsianlin Dzeng and Christopher T. Haynes. Type reconstruction for variable-arity procedures. In LFP '94: Proceedings of the 1994 ACM conference on LISP and Functional Programming, pages 239--249, New York, NY, USA, 1994. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. ECMA International. ECMAScript Edition 4 group wiki, 2007.Google ScholarGoogle Scholar
  12. Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shriram Krishnamurthi. How to Design Programs. MIT Press, 2001. URL http://www.htdp.org/.Google ScholarGoogle Scholar
  13. Robert Bruce Findler and Matthias Felleisen. Contracts for higher-order functions. In ICFP '02: ACM SIGPLAN International Conference on Functional Programming, pages 48--59, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Robert Bruce Findler, John Clements, Cormac Flanagan, Matthew Flatt, Shriram Krishnamurthi, Paul Steckler, and Matthias Felleisen. DrScheme: A programming environment for Scheme. Journal of Functional Programming, 12(2): 159--182, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Cormac Flanagan and Matthias Felleisen. Componential set-based analysis. ACM Trans. Program. Lang. Syst., 21(2):370--416, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Cormac Flanagan, Matthew Flatt, Shriram Krishnamurthi, Stephanie Weirich, and Matthias Felleisen. Catching bugs in the web of program invariants. In PLDI '96: ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 23--32, May 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Matthew Flatt. Composable and compilable macros: You want it when? In ICFP '02: ACM SIGPLAN International Conference on Functional Programming, pages 72--83, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Matthew Flatt and Matthias Felleisen. Units: Cool modules for HOT languages. In PLDI '98: ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 236--248, June 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Matthew Flatt, Robert Bruce Findler, and Matthias Felleisen. Scheme with classes, mixins, and traits. In Asian Symposium on Programming Languages and Systems (APLAS) 2006, pages 270--289, November 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Daniel P. Friedman and Matthias Felleisen. The Little Schemer, Fourth Edition. MIT Press, Cambridge, 1997.Google ScholarGoogle Scholar
  21. Daniel P. Friedman and Matthias Felleisen. The Seasoned Schemer. MIT Press, Cambridge, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. David Gifford, Pierre Jouvelot, John Lucassen, and Mark Sheldon. FX-87 Reference Manual. Technical Report MIT/LCS/TR-407, Massachusetts Institute of Technology, Laboratory for Computer Science, September 1987.Google ScholarGoogle Scholar
  23. J. Gosling, B. Joy, G. L.Steele, and G. Bracha. The Java Language Specification, Third Edition. Addison-Welsley, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Timothy G. Griffin. The formulae-as-types notion of control. In POPL '90: Conf. Record 17th Annual ACM Symp. on Principles of Programming Languages, Jan 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Robert Harper and Greg Morrisett. Compiling polymorphism using intensional type analysis. In POPL '95: ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 130--141, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Christopher T. Haynes. Infer: A statically-typed dialect of scheme. Technical Report 367, Indiana University, 1995.Google ScholarGoogle Scholar
  27. Nevin Heintze. Set based analysis of ML programs. In LFP '94: ACM Symposium on Lisp and Functional Programming, pages 306--317, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Fritz Henglein and Jakob Rehof. Safe polymorphic type inference for a dynamically typed language: translating Scheme to ML. In FPCA '95: Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture, pages 192--203, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. David Herman, Aaron Tomb, and Cormac Flanagan. Space-efficient gradual typing. In 8th Symposium on Trends in Functional Programming, April 2007.Google ScholarGoogle Scholar
  30. Gary T. Leavens, Curtis Clifton, and Brian Dorn. A Type Notation for Scheme. Technical Report 05--18a, Iowa State University, August 2005.Google ScholarGoogle Scholar
  31. Jacob Matthews. Component deployment with PLaneT: You want it where? In Proceedings of the Seventh Workshop on Scheme and Functional Programming, University of Chicago, Technical Report TR-2006-06, 2006.Google ScholarGoogle Scholar
  32. Jacob Matthews, Robert Findler, Matthew Flatt, and Matthias Felleisen. A visual environment for developing context-sensitive term rewriting systems. In RTA 2004: Rewriting Techniques and Applications, 15th International Conference, Aachen, Germany, June 3-5, 2004, Proceedings, volume 3091 of Lecture Notes in Computer Science, pages 2--16. Springer-Verlag, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  33. Philippe Meunier, Robert Bruce Findler, and Matthias Felleisen. Modular set-based analysis from contracts. In POPL '06: Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 218--231, New York, NY, USA, 2006. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Tobias Nipkow, Lawrence C. Paulson, and Markus Wenzel. Isabelle/HOL - A Proof Assistant for Higher-Order Logic, volume 2283 of LNCS. Springer, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Benjamin C. Pierce. Programming with intersection types, union types, and polymorphism. Technical Report CMU-CS-91-106, Carnegie Mellon University, February 1991.Google ScholarGoogle Scholar
  36. Benjamin C. Pierce and David N. Turner. Local type inference. volume 22, pages 1--44, New York, NY, USA, 2000. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. John C. Reynolds. Types, abstraction, and parametric polymorphism. In REA. Mason, editor, Information Processing 83, Paris, France, pages 513--523. Elsevier, 1983.Google ScholarGoogle Scholar
  38. Michael Salib. Starkiller: A static type inferencer and compiler for Python. Master's thesis, Massachusetts Institute of Technology, Cambridge, Massachusetts, May 2004.Google ScholarGoogle Scholar
  39. Olin Shivers. Control-Flow Analysis of Higher-Order Languages or Taming Lambda. PhD thesis, Carnegie Mellon University, Pittsburgh, Pennsylvania, May 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Jeremy G. Siek and Walid Taha. Gradual typing for functional languages. In Scheme and Functional Programming Workshop, University of Chicago, Technical Report TR-2006-06, pages 81--92, September 2006.Google ScholarGoogle Scholar
  41. Jens Axel Søgaard. Galore, 2006. http://planet.plt-scheme.org/.Google ScholarGoogle Scholar
  42. Guy Lewis Steele Jr. Common Lisp-The Language. Digital Press, 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Audrey Tang. Perl 6: reconciling the irreconcilable. In POPL '07: Proceedings of the 34th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 1--1, New York, NY, USA, 2007. ACM Press. http://pugscode.org. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Sam Tobin-Hochstadt and Matthias Felleisen. Interlanguage migration: from scripts to programs. In OOPSLA '06: Companion to the 21st ACM SIGPLAN Conference on Object-oriented Programming Systems, Languages, and Applications, pages 964--974, New York, NY, USA, 2006. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Christian Urban and Christine Tasson. Nominal Reasoning Techniques in Isabelle/HOL. In Proceedings of the 20th Conference on Automated Deduction (CADE 2005), volume 3632 of Lecture Notes in Artificial Intelligence. Springer, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Dimitrios Vytiniotis, Stephanie Weirich, and Simon Peyton Jones. Boxy types: inference for higher-rank types and impredicativity. In ICFP '06: Proceedings of the Eleventh ACM SIGPLAN International Conference on Functional Programming, pages 251--262, New York, NY, USA, 2006. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Philip Wadler and Robert Bruce Findler. Well-typed programs can't be blamed. In Proceedings of the Eighth Workshop on Scheme and Functional Programming, 2007.Google ScholarGoogle Scholar
  48. Mitchell Wand. A semantic prototyping system. In SIGPLAN '84: Proceedings of the 1984 SIGPLAN Symposium on Compiler Construction, pages 213--221, New York, NY, USA, 1984. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. A. Wright and B. Duba. Pattern matching for Scheme. Technical report, Rice University, May 1995.Google ScholarGoogle Scholar
  50. Andrew Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, pages 38--94, 1994. First appeared as Technical Report TR160, Rice University, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Andrew K. Wright and Robert Cartwright. A practical soft type system for scheme. ACM Trans. Program. Lang. Syst., 19(1): 87--152, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. The design and implementation of typed scheme

        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

        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!