Abstract
Gradual typing is a framework to combine static and dynamic typing in a single programming language. In this paper, we develop a gradual type system for class-based object-oriented languages with generics. We introduce a special type to denote dynamically typed parts of a program; unlike dynamic types introduced to C# 4.0, however, our type system allows for more seamless integration of dynamically and statically typed code.
We formalize a gradual type system for Featherweight GJ with a semantics given by a translation that inserts explicit run-time checks. The type system guarantees that statically typed parts of a program do not go wrong, even if it includes dynamically typed parts. We also describe a basic implementation scheme for Java and report preliminary performance evaluation.
- M. Abadi, L. Cardelli, B. Pierce, and G. Plotkin. Dynamic typing in a statically typed language. ACM Trans. Prog. Lang. Syst., 13 (2): 237--268, 1991. Google Scholar
Digital Library
- A. Ahmed, R. B. Findler, J. G. Siek, and P. Wadler. Blame for all. In Proc. of ACM POPL'11, pages 201--214, Austin, TX, Jan. 2011. Google Scholar
Digital Library
- C. Anderson and S. Drossopoulou. BabyJ - from object based to class based programming via types. In Proc. of WOOD'03, volume 82 of Elsevier ENTCS, pages 53--81, 2003.Google Scholar
- G. Bierman, E. Meijer, and M. Torgersen. Adding dynamic types to \Csharp. In Proc. of ECOOP'10, volume 6183 of Springer LNCS, pages 76--100, Maridbor, Slovenia, June 2010. Google Scholar
Digital Library
- B. Bloom, J. Field, N. Nystrom, J. Östlund, G. Richards, R. Strni\v sa, J. Vitek, and T. Wrigstad. Thorn -- robust, concurrent, extensible scripting on the JVM. In Proc. of ACM OOPSLA'09, pages 117--136, Orlando, FL, Oct. 2009. Google Scholar
Digital Library
- G. Bracha and D. Griswold. Strongtalk: Typechecking Smalltalk in a production environment. In Proc. of ACM OOPSLA'93, pages 215--230, 1993. Google Scholar
Digital Library
- G. Bracha, M. Odersky, D. Stoutamire, and P. Wadler. Making the future safe for the past: Adding genericity to the Java programming language. In Proc. of ACM OOPSLA'98, pages 183--200, Vancouver, BC, Oct. 1998. Google Scholar
Digital Library
- R. Cartwright and M. Fagan. Soft typing. In Proc. of ACM PLDI'91, pages 278--292, 1991. Google Scholar
Digital Library
- R. B. Findler and M. Felleisen. Contracts for higher-order functions. In Proc. of ACM ICFP'02, pages 48--59, 2002. Google Scholar
Digital Library
- C. Flanagan. Hybrid type checking. In Proc. of ACM POPL'06, pages 245--256, Charleston, SC, Jan. 2006. Google Scholar
Digital Library
- M. Furr, J. An, J. S. Foster, and M. Hicks. Static type inference for Ruby. In Proc. of ACM Symposium on Applied Computing (SAC'09), pages 1859--1866, Mar. 2009. Google Scholar
Digital Library
- K. E. Gray. Safe cross-language inheritance. In Proc. of ECOOP'08, volume 5142 of Springer LNCS, pages 52--75, 2008. Google Scholar
Digital Library
- K. E. Gray. Interoperability in a scripted world: Putting inheritance & prototypes together. In Proc. of FOOL'10, Oct. 2010.Google Scholar
- K. E. Gray, R. B. Findler, and M. Flatt. Fine-grained interoperability through mirrors and contracts. In Proc. of ACM OOPSLA'05, pages 231--245, 2005. Google Scholar
Digital Library
- J. Gronski, K. Knowles, A. Tomb, S. N. Freund, and C. Flanagan. Sage: Hybrid checking for flexible specifications. In Proc. of the Scheme and Functional Programming Workshop, pages 93--104, Sept. 2006.Google Scholar
- F. Henglein. Dynamic typing. In Proc. of ESOP'92, volume 582 of Springer LNCS, pages 233--253, Rennes, France, Feb. 1992. Google Scholar
Digital Library
- A. Igarashi and M. Viroli. Variant parametric types: A flexible subtyping scheme for generics. ACM Trans. Prog. Lang. Syst., 28 (5): 795--847, Sept. 2006. Google Scholar
Digital Library
- A. Igarashi, B. C. Pierce, and P. Wadler. Featherweight Java: A minimal core calculus for Java and GJ. ACM Trans. Prog. Lang. Syst., 23 (3): 396--450, May 2001. Google Scholar
Digital Library
- }InaIgarashi09STOPL. Ina and A. Igarashi. Towards gradual typing for generics. In Proc. of STOP'09, pages 17--29, Genova, Italy, July 2009\natexlaba. Available also in the ACM Digital Library. Google Scholar
Digital Library
- }ina09:fjgradL. Ina and A. Igarashi. Gradual typing for Featherweight Java. Computer Software, 26 (2): 18--40, Apr. 2009\natexlabb. In Japanese.Google Scholar
- A. J. Kennedy and B. C. Pierce. On decidability of nominal subtyping with variance. In Proc. of FOOL/WOOD'07, Nice, France, Jan. 2007.Google Scholar
- G. Lagorio and E. Zucca. Just: safe unknown types in Java-like languages. Journal of Object Technology, 6 (2): 69--98, Feb. 2007.Google Scholar
Cross Ref
- B. H. Liskov and J. M. Wing. A behavioral notion of subtyping. ACM Trans. Prog. Lang. Syst., 16 (6): 1811--1841, Nov. 1994. Google Scholar
Digital Library
- J. Matthews and A. Ahmed. Parametric polymorphism through run-time sealing, or, thorems for low, low prices! In Proc. of ESOP'08, volume 4960 of Springer LNCS, pages 16--31, 2008. Google Scholar
Digital Library
- M. Odersky and P. Wadler. Pizza into Java: Translating theory into practice. In Proc. of ACM POPL'97, pages 146--159, Jan. 1997. Google Scholar
Digital Library
- I. Sergey and D. Clarke. Towards gradual ownership types. In Proc. of IWACO'11, Lancaster, UK, July 2011.Google Scholar
- J. G. Siek and W. Taha. Gradual typing for functional languages. In Proc. of the Scheme and Functional Programming Workshop, pages 81--92, Sept. 2006.Google Scholar
- J. G. Siek and W. Taha. Gradual typing for objects. In Proc. of ECOOP'07, volume 4509 of Springer LNCS, pages 2--27, 2007. Google Scholar
Digital Library
- S. Thatte. Quasi-static typing. In Proc. of ACM POPL'90, pages 367--381, Jan. 1990. Google Scholar
Digital Library
- P. Thiemann. Towards a type system for analyzing JavaScript programs. In Proc. of ESOP'09, volume 3444 of Springer LNCS, pages 408--422, 2005. Google Scholar
Digital Library
- M. Torgersen, E. Ernst, C. P. Hansen, P. von der Ahé, G. Bracha, and N. Gafter. Adding wildcards to the Java programming language. Journal of Object Technology, 3 (11): 97--116, Dec. 2004. Special issue: OOPS track at SAC 2004.Google Scholar
Cross Ref
- M. Viroli. A type-passing approach for the implementation of parametric methods in Java. The Computer Journal, 46 (3): 263--294, 2003.Google Scholar
Cross Ref
- M. Viroli. Effective and efficient compilation of run-time generics in Java. In Proc. of WOOD'04, volume 138 of Elsevier ENTCS, pages 95--116, 2004. Google Scholar
Digital Library
- M. Viroli and A. Natali. Parametric polymorphism in Java: An approach to translation based on reflective features. In Proc. of ACM OOPSLA'00, pages 146--165, Oct. 2000. Google Scholar
Digital Library
- P. Wadler and R. B. Findler. Well-typed programs can't be blamed. In Proc. of ESOP'09, volume 5502 of Springer LNCS, pages 1--16, York, UK, Mar. 2009. Google Scholar
Digital Library
- R. Wolff, R. Garcia, É. Tanter, and J. Aldrich. Gradual typestate. In Proc. of ECOOP'11, volume 6813 of Springer LNCS, pages 459--483, Lancaster, UK, July 2011. Google Scholar
Digital Library
- A. K. Wright and M. Felleisen. A syntactic approach to type soundness. Information and Computation, 115 (1): 38--94, Nov. 1994. Google Scholar
Digital Library
- T. Wrigstad, F. Z. Nardelli, S. Lebresne, J. Östlund, and J. Vitek. Integrating typed and untyped code in a scripting language. In Proc. of ACM POPL'10, pages 377--388, 2010. Google Scholar
Digital Library
Index Terms
Gradual typing for generics
Recommendations
Gradual typing for generics
OOPSLA '11: Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applicationsGradual typing is a framework to combine static and dynamic typing in a single programming language. In this paper, we develop a gradual type system for class-based object-oriented languages with generics. We introduce a special type to denote ...
On polymorphic gradual typing
We study an extension of gradual typing—a method to integrate dynamic typing and static typing smoothly in a single language—to parametric polymorphism and its theoretical properties, including conservativity of typing and semantics over both statically ...
Gradual typing: a new perspective
We define a new, more semantic interpretation of gradual types and use it to ``gradualize'' two forms of polymorphism: subtyping polymorphism and implicit parametric polymorphism. In particular, we use the new interpretation to define three gradual type ...







Comments