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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Abadi, M., Cardelli, L.: A Theory of Objects. Springer-Verlag, New York (1996)
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)
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)
Anderson, C., Drossopoulou, S.: BabyJ - from object based to class based programming via types. In: WOOD ’03, vol, vol. 82, Elsevier, Amsterdam (2003)
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)
Bracha, G.: Pluggable type systems. In: OOPSLA’04 Workshop on Revival of Dynamic Languages (2004)
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)
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)
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)
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)
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)
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)
de Oliveira, R.B.: The Boo programming language (2005), http://boo.codehaus.org
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)
ECMA Standard ECMA-262: ECMAScript Language Specification (1999)
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)
Felleisen, M., Friedman, D.P.: Control operators, the SECD-machine and the lambda-calculus. pp. 193–217 (1986)
Felleisen, M., Hieb, R.: The revised report on the syntactic theories of sequential control and state. Theoretical Computer Science 103(2), 235–271 (1992)
Findler, R.B., Felleisen, M.: Contracts for higher-order functions. In: ACM International Conference on Functional Programming, ACM Press, New York (2002)
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)
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)
Flanagan, C., Felleisen, M.: Componential set-based analysis. ACM Trans. Program. Lang. Syst. 21(2), 370–416 (1999)
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)
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)
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)
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)
Group, E.T.W.: Ecmascript 4 netscape proposal
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)
Henglein, F.: Dynamic typing: syntax and proof theory. Science of Computer Programming 22(3), 197–230 (1994)
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)
Herman, D., Tomb, A., Flanagan, C.: Space-efficient gradual typing. In: Trends in Functional Programming (TFP), April 2007 (2007)
Hindley, R.: The principal type-scheme of an object in combinatory logic. Trans AMS 146, 29–60 (1969)
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)
Kelsey, R., Clinger, W., Rees, J. (eds.): Revised5 report on the algorithmic language scheme. Higher-Order and Symbolic Computation, 11(1) (August 1998)
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)
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)
Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17(3), 348–375 (1978)
Nanevski, A.: A modal calculus for exception handling. In: Intuitionistic Modal Logics and Applications Workshop (IMLA ’05), Chicago, IL, June 2005 (2005)
Nipkow, T., Paulson, L.C., Wenzel, M. (eds.): Isabelle/HOL. LNCS, vol. 2283. Springer, Heidelberg (2002)
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)
Pierce, B.C.: Types and programming languages. MIT Press, Cambridge, MA, USA (2002)
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)
Sabry, A.: Minml: Syntax, static semantics, dynamic semantics, and type safety. Course notes for b522 (February 2002)
Serrano, M.: Bigloo: a practical Scheme compiler. Inria-Rocquencourt (April 2002)
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)
Siek, J., Taha, W.: Gradual typing for objects: Isabelle formaliztaion. Technical Report CU-CS-1021-06, University of Colorado, Boulder, CO (December 2006)
Siek, J.G., Taha, W.: Gradual typing for functional languages. In: Scheme and Functional Programming Workshop (September 2006)
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)
Tang, A.: Pugs blog
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)
Tobin-Hochstadt, S., Felleisen, M.: Interlanguage migration: From scripts to programs. In: Dynamic Languages Symposium (2006)
Wenzel, M.: The Isabelle/Isar Reference Manual. TU München (April 2004)
Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Information and Computation 115(1), 38–94 (1994)
Author information
Authors and Affiliations
Editor information
Rights 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)