Skip to main content

Gradual Typing for Objects

  • Conference paper
ECOOP 2007 – Object-Oriented Programming (ECOOP 2007)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 4609))

Included in the following conference series:

Abstract

Static and dynamic type systems have well-known strengths and weaknesses. In previous work we developed a gradual type system for a functional calculus named \(\lambda^?_\to\). Gradual typing provides the benefits of both static and dynamic checking in a single language by allowing the programmer to control whether a portion of the program is type checked at compile-time or run-time by adding or removing type annotations on variables. Several object-oriented scripting languages are preparing to add static checking. To support that work this paper develops \(\mathbf{Ob}^{?}_{<:}\), a gradual type system for object-based languages, extending the Ob < : calculus of Abadi and Cardelli. Our primary contribution is to show that gradual typing and subtyping are orthogonal and can be combined in a principled fashion. We also develop a small-step semantics, provide a machine-checked proof of type safety, and improve the space efficiency of higher-order casts.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Abadi, M., Cardelli, L.: A Theory of Objects. Springer-Verlag, New York (1996)

    MATH  Google Scholar 

  2. Abadi, M., Cardelli, L., Pierce, B., Plotkin, G.: Dynamic typing in a statically typed language. ACM Transactions on Programming Languages and Systems 13(2), 237–268 (1991)

    Article  Google Scholar 

  3. Aiken, A., Wimmers, E.L., Lakshman, T.K.: Soft typing with conditional types. In: POPL ’94: Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages, Portland, Oregon, United States, pp. 163–173. ACM Press, New York (1994)

    Chapter  Google Scholar 

  4. Anderson, C., Drossopoulou, S.: BabyJ - from object based to class based programming via types. In: WOOD ’03, vol, vol. 82, Elsevier, Amsterdam (2003)

    Google Scholar 

  5. Aydemir, B.E., Bohannon, A., Fairbairn, M., Foster, J.N., Pierce, B.C., Sewell, P., Vytiniotis, D., Weirich, G.W.S., Zdancewic, S.: Mechanized metatheory for the masses: The POPLmark challenge (May 2005)

    Google Scholar 

  6. Bracha, G.: Pluggable type systems. In: OOPSLA’04 Workshop on Revival of Dynamic Languages (2004)

    Google Scholar 

  7. Bracha, G., Griswold, D.: Strongtalk: typechecking smalltalk in a production environment. In: OOPSLA ’93: Proceedings of the eighth annual conference on Object-oriented programming systems, languages, and applications, pp. 215–230. ACM Press, New York (1993)

    Chapter  Google Scholar 

  8. Bres, Y., Serpette, B.P., Serrano, M.: Compiling scheme programs to.NET common intermediate language. In: 2nd International Workshop on.NET Technologies, Pilzen, Czech Republic (May 2004)

    Google Scholar 

  9. Cartwright, R., Fagan, M.: Soft typing. In: PLDI ’91: Proceedings of the ACM SIGPLAN 1991 conference on Programming language design and implementation, pp. 278–292. ACM Press, New York (1991)

    Chapter  Google Scholar 

  10. Chambers, C., the Cecil Group.: The Cecil language: Specification and rationale. Technical report, Department of Computer Science and Engineering, University of Washington, Seattle, Washington (2004)

    Google Scholar 

  11. Chambers, C., Ungar, D., Lee, E.: An efficient implementation of self a dynamically-typed object-oriented language based on prototypes. In: OOPSLA ’89: Conference proceedings on Object-oriented programming systems, languages and applications, pp. 49–70. ACM Press, New York (1989)

    Chapter  Google Scholar 

  12. Damas, L., Milner, R.: Principal type-schemes for functional programs. In: POPL ’82: Proceedings of the 9th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 207–212. ACM Press, New York (1982)

    Chapter  Google Scholar 

  13. de Oliveira, R.B.: The Boo programming language (2005), http://boo.codehaus.org

  14. Dean, J., Chambers, C., Grove, D.: Selective specialization for object-oriented languages. In: PLDI ’95: Proceedings of the ACM SIGPLAN 1995 conference on Programming language design and implementation, La Jolla, California, United States, pp. 93–102. ACM Press, New York (1995)

    Chapter  Google Scholar 

  15. ECMA Standard ECMA-262: ECMAScript Language Specification (1999)

    Google Scholar 

  16. Feinberg, N., Keene, S.E., Mathews, R.O., Withington, P.T.: Dylan programming: an object-oriented and dynamic language. Addison Wesley Longman Publishing, Redwood City, CA (1997)

    MATH  Google Scholar 

  17. Felleisen, M., Friedman, D.P.: Control operators, the SECD-machine and the lambda-calculus. pp. 193–217 (1986)

    Google Scholar 

  18. Felleisen, M., Hieb, R.: The revised report on the syntactic theories of sequential control and state. Theoretical Computer Science 103(2), 235–271 (1992)

    Article  MATH  MathSciNet  Google Scholar 

  19. Findler, R.B., Felleisen, M.: Contracts for higher-order functions. In: ACM International Conference on Functional Programming, ACM Press, New York (2002)

    Google Scholar 

  20. Findler, R.B., Flatt, M., Felleisen, M.: Semantic casts: Contracts and structural subtyping in a nominal world. In: European Conference on Object-Oriented Programming (2004)

    Google Scholar 

  21. Flanagan, C.: Hybrid type checking. In: POPL 2006: The 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Charleston, South Carolina, pp. 245–256. ACM Press, New York (2006)

    Chapter  Google Scholar 

  22. Flanagan, C., Felleisen, M.: Componential set-based analysis. ACM Trans. Program. Lang. Syst. 21(2), 370–416 (1999)

    Article  Google Scholar 

  23. Flanagan, C., Flatt, M., Krishnamurthi, S., Weirich, S., Felleisen, M.: Catching bugs in the web of program invariants. In: PLDI ’96: Proceedings of the ACM SIGPLAN 1996 conference on Programming language design and implementation, Philadelphia, Pennsylvania, United States, pp. 23–32. ACM Press, New York (1996)

    Chapter  Google Scholar 

  24. Flanagan, C., Freund, S.N., Tomb, A.: Hybrid types, invariants, and refinements for imperative objects. In: FOOL/WOOD ’06: International Workshop on Foundations and Developments of Object-Oriented Languages (2006)

    Google Scholar 

  25. Gray, K.E., Findler, R.B., Flatt, M.: Fine-grained interoperability through mirrors and contracts. In: OOPSLA ’05: Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming systems languages and applications, pp. 231–245. ACM Press, New York, NY, USA (2005)

    Chapter  Google Scholar 

  26. Gronski, J., Knowles, K., Tomb, A., Freund, S.N., Flanagan, C.: Sage: Hybrid checking for flexible specifications. Technical report, University of California, Santa Cruz (2006)

    Google Scholar 

  27. Group, E.T.W.: Ecmascript 4 netscape proposal

    Google Scholar 

  28. Gunter, C.A., Remy, D., Riecke, J.G.: A generalization of exceptions and control in ml-like languages. In: FPCA ’95: Proceedings of the seventh international conference on Functional programming languages and computer architecture, La Jolla, California, United States, pp. 12–23. ACM Press, New York (1995)

    Chapter  Google Scholar 

  29. Henglein, F.: Dynamic typing: syntax and proof theory. Science of Computer Programming 22(3), 197–230 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  30. Henglein, F., Rehof, J.: Safe polymorphic type inference for a dynamically typed language: Translating scheme to ml. In: FPCA ’95, ACM SIGPLAN-SIGARCH Conference on Functional Programming Languages and Computer Architecture, La Jolla, California (June 1995)

    Google Scholar 

  31. Herman, D., Tomb, A., Flanagan, C.: Space-efficient gradual typing. In: Trends in Functional Programming (TFP), April 2007 (2007)

    Google Scholar 

  32. Hindley, R.: The principal type-scheme of an object in combinatory logic. Trans AMS 146, 29–60 (1969)

    Article  MATH  MathSciNet  Google Scholar 

  33. Steele Jr., G.L.: An overview of COMMON LISP. In: LFP ’82: Proceedings of the, ACM symposium on LISP and functional programming, pp. 98–107. ACM Press, New York (1982)

    Chapter  Google Scholar 

  34. Kelsey, R., Clinger, W., Rees, J. (eds.): Revised5 report on the algorithmic language scheme. Higher-Order and Symbolic Computation, 11(1) (August 1998)

    Google Scholar 

  35. Matthews, J., Findler, R.B.: Operational semantics for multi-language programs. In: The 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, January 2007, ACM Press, New York (2007)

    Google Scholar 

  36. Meijer, E., Drayton, P.: Static typing where possible, dynamic typing when needed: The end of the cold war between programming languages. In: OOPSLA’04 Workshop on Revival of Dynamic Languages (2004)

    Google Scholar 

  37. Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17(3), 348–375 (1978)

    Article  MATH  MathSciNet  Google Scholar 

  38. Nanevski, A.: A modal calculus for exception handling. In: Intuitionistic Modal Logics and Applications Workshop (IMLA ’05), Chicago, IL, June 2005 (2005)

    Google Scholar 

  39. Nipkow, T., Paulson, L.C., Wenzel, M. (eds.): Isabelle/HOL. LNCS, vol. 2283. Springer, Heidelberg (2002)

    MATH  Google Scholar 

  40. Ou, X., Tan, G., Mandelbaum, Y., Walker, D.: Dynamic typing with dependent types (extended abstract). In: 3rd IFIP International Conference on Theoretical Computer Science (August 2004)

    Google Scholar 

  41. Pierce, B.C.: Types and programming languages. MIT Press, Cambridge, MA, USA (2002)

    Google Scholar 

  42. Riely, J., Hennessy, M.: Trust and partial typing in open systems of mobile agents. In: POPL ’99: Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 93–104. ACM Press, New York (1999)

    Chapter  Google Scholar 

  43. Sabry, A.: Minml: Syntax, static semantics, dynamic semantics, and type safety. Course notes for b522 (February 2002)

    Google Scholar 

  44. Serrano, M.: Bigloo: a practical Scheme compiler. Inria-Rocquencourt (April 2002)

    Google Scholar 

  45. Shalit, A.: The Dylan reference manual: the definitive guide to the new object-oriented dynamic language. Addison Wesley Longman Publishing Co. Inc., Redwood City, CA (1996)

    MATH  Google Scholar 

  46. Siek, J., Taha, W.: Gradual typing for objects: Isabelle formaliztaion. Technical Report CU-CS-1021-06, University of Colorado, Boulder, CO (December 2006)

    Google Scholar 

  47. Siek, J.G., Taha, W.: Gradual typing for functional languages. In: Scheme and Functional Programming Workshop (September 2006)

    Google Scholar 

  48. Taha, W., Makholm, H., Hughes, J.: Tag elimination and jones-optimality. In: Danvy, O., Filinski, A. (eds.) PADO 2001. LNCS, vol. 2053, pp. 257–275. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  49. Tang, A.: Pugs blog

    Google Scholar 

  50. Thatte, S.: Quasi-static typing. In: POPL ’90: Proceedings of the 17th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 367–381. ACM Press, New York (1990)

    Chapter  Google Scholar 

  51. Tobin-Hochstadt, S., Felleisen, M.: Interlanguage migration: From scripts to programs. In: Dynamic Languages Symposium (2006)

    Google Scholar 

  52. Wenzel, M.: The Isabelle/Isar Reference Manual. TU München (April 2004)

    Google Scholar 

  53. Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Information and Computation 115(1), 38–94 (1994)

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Erik Ernst

Rights and permissions

Reprints and permissions

Copyright information

© 2007 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Siek, J., Taha, W. (2007). Gradual Typing for Objects. In: Ernst, E. (eds) ECOOP 2007 – Object-Oriented Programming. ECOOP 2007. Lecture Notes in Computer Science, vol 4609. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-73589-2_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-73589-2_2

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-73588-5

  • Online ISBN: 978-3-540-73589-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics