Abstract
Gradual typing enables a smooth and progressive integration of static and dynamic typing. The semantics of a gradually-typed program is given by translation to an intermediate language with casts: runtime type checks that control the boundaries between statically- and dynamically-typed portions of a program. This paper studies the performance of different cast insertion strategies in the context of Gradualtalk, a gradually-typed Smalltalk. We first implement the strategy specified by Siek and Taha, which inserts casts at call sites. We then study the dual approach, which consists in performing casts in callees. Based on the observation that both strategies perform well in different scenarios, we design a hybrid strategy that combines the best of each approach. We evaluate these three strategies using both micro- and macro-benchmarks. We also discuss the impact of these strategies on memory, modularity, and inheritance. The hybrid strategy constitutes a promising cast insertion strategy for adding gradual types to existing dynamically-typed languages.
- R. Cartwright, M. Fagan, Soft typing, in: Proceedings of the ACM SIGPLAN 1991 conference on Programming language design and implementation, PLDI '91, 1991, pp. 278--292. Google Scholar
Digital Library
- G. Bracha, 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), ACM Press, Washington, D.C., USA, 1993, pp. 215--230, aCM SIGPLAN Notices, 28(10). Google Scholar
Digital Library
- G. Bracha, Pluggable type systems, in: OOPSLA Workshop on Revival of Dynamic Languages, 2004, pp. 1--6.Google Scholar
- K. Knowles, C. Flanagan, Hybrid type checking, ACM Transactions on Programming Languages and Systems 32 (2) (2010) Article n.6. Google Scholar
Digital Library
- S. Tobin-Hochstadt, Typed Scheme: From Scripts to Programs, Ph.D. thesis, Northeastern University (Jan. 2010).Google Scholar
- M. Furr, Combining static and dynamic typing in Ruby, Ph.D. thesis, University of Maryland (2009).Google Scholar
- A. Rastogi, A. Chaudhuri, 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), ACM Press, Philadelphia, USA, 2012, pp. 481--494. Google Scholar
Digital Library
- J. Siek, W. Taha, Gradual typing for functional languages, in: Proceedings of the Scheme and Functional Programming Workshop, 2006, pp. 81--92.Google Scholar
- J. Siek, W. Taha, Gradual typing for objects, in: E. Ernst (Ed.), Proceedings of the 21st European Conference on Object-oriented Programming (ECOOP 2007), no. 4609 in Lecture Notes in Computer Science, Springer-Verlag, Berlin, Germany, 2007, pp. 2--27. Google Scholar
Digital Library
- A. Goldberg, D. Robson, Smalltalk-80: The Language and its Implementation, Addison-Wesley, 1983. Google Scholar
Digital Library
- P. Wadler, R. B. Findler, Well-typed programs can't be blamed, in: ESOP 2009, pp. 1--16. Google Scholar
Digital Library
- C. Saito, A. Igarashi, hrefhttp://doi.acm.org/10.1145/1640089.1640109Self type constructors, in: Proceedings of the 24th ACM SIGPLAN conference on Object oriented programming systems languages and applications, OOPSLA '09, ACM, New York, NY, USA, 2009, pp. 263--282.href http://dx.doi.org/10.1145/1640089.1640109pathdoi:10.1145/1640089.1640109. http://doi.acm.org/10.1145/1640089.1640109 Google Scholar
Digital Library
- R. B. Findler, M. Felleisen, Contracts for higher-order functions, in: Proceedings of the 7th ACM SIGPLAN International Conference on Functional Programming, ACM Press, Pittsburgh, PA, USA, 2002, pp. 48--59. Google Scholar
Digital Library
- J. Siek, R. Garcia, W. Taha, Exploring the design space of higher-order casts, in: ESOP 2009, pp. 17--31. Google Scholar
Digital Library
- B. C. Pierce, Types and programming languages, MIT Press, Cambridge, MA, USA, 2002. Google Scholar
Digital Library
- L. Ina, A. Igarashi, Gradual typing for generics, in: Proceedings of the 26th ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2011), ACM Press, Portland, Oregon, USA, 2011, pp. 609--624. Google Scholar
Digital Library
- S. Tobin-Hochstadt, M. Felleisen, Logical types for untyped languages, in: Proceedings of the 15th ACM SIGPLAN Conference on Functional Programming (ICFP 2010), ACM Press, Baltimore, Maryland, USA, 2010, pp. 117--128. Google Scholar
Digital Library
- A. Guha, C. Saftoiu, S. Krishnamurthi, Typing local control and state using flow analysis, in: G. Barthe (Ed.), Proceedings of the 20th European Symposium on Programming (ESOP 2011), Vol. 6602 of Lecture Notes in Computer Science, Springer-Verlag, 2011, pp. 256--275. Google Scholar
Digital Library
- N. Schärli, S. Ducasse, O. Nierstrasz, A. Black, Traits: Composable units of behavior, in: L. Cardelli (Ed.), Proceedings of the 17th European Conference on Object-Oriented Programming (ECOOP 2003), no. 2743 in Lecture Notes in Computer Science, Springer-Verlag, Darmstadt, Germany, 2003, pp. 248--274.Google Scholar
Cross Ref
- D. Malayeri, J. Aldrich, Integrating nominal and structural subtyping, in: J. Vitek (Ed.), Proceedings of the 22nd European Conference on Object-oriented Programming (ECOOP 2008), no. 5142 in Lecture Notes in Computer Science, Springer-Verlag, Paphos, Cyprus, 2008, pp. 260--284. Google Scholar
Digital Library
- D. Malayeri, J. Aldrich, Is structural subtyping useful? an empirical study, in: ESOP 2009, pp. 95--111. Google Scholar
Digital Library
- D. Doligez, A. Frisch, J. Garrigue, D. Rémy, J. Vouillon, The OCaml system release 3.12, Institut National de Recherche en Informatique et en Automatique, http://caml.inria.fr/pub/docs/manual-ocaml/index.html (Jul 2011).Google Scholar
- É. P. F. de Lausanne (EPFL), Scala, http://www.scala-lang.org.Google Scholar
- L. Cardelli, Type systems, in: A. B. Tucker (Ed.), The Computer Science and Engineering Handbook, CRC Press, 1997, Ch. 103, pp. 2208--2236.Google Scholar
- O. Callaú, É. Tanter, Programming with ghosts, IEEE Software 30 (1) (2013) 74--80. Google Scholar
Digital Library
- R. Wolff, R. Garcia, É. Tanter, J. Aldrich, Gradual typestate, in: M. Mezini (Ed.), Proceedings of the 25th European Conference on Object-oriented Programming (ECOOP 2011), Vol. 6813 of Lecture Notes in Computer Science, Springer-Verlag, Lancaster, UK, 2011, pp. 459--483. Google Scholar
Digital Library
- G. Bracha, The strongtalk type system for smalltalk, http://www.bracha.org/nwst.html.Google Scholar
- R. Smit, Pegon, http://sourceforge.net/projects/pegon/.Google Scholar
- S. Tobin-Hochstadt, V. St-Amour, The typed racket guide, http://docs.racket-lang.org/ts-guide/.Google Scholar
- I. Figueroa, É. Tanter, N. Tabareau, A practical monadic aspect weaver, in: Proceedings of the 11th Workshop on Foundations of Aspect-Oriented Languages (FOAL 2012), ACM Press, Potsdam, Germany, 2012, pp. 21--26. Google Scholar
Digital Library
- R. E. Johnson, Type-checking smalltalk, SIGPLAN Not. 21 (11) (1986) 315--321. Google Scholar
Digital Library
- R. E. Johnson, J. O. Graver, L. W. Zurawski, Ts: an optimizing compiler for smalltalk, SIGPLAN Not. 23 (11) (1988) 18--26. Google Scholar
Digital Library
- J. O. Graver, R. E. Johnson, A type system for smalltalk, in: POPL '90: Proceedings of the 17th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, 1990, pp. 136--150. Google Scholar
Digital Library
- N. Haldiman, M. Denker, O. Nierstrasz, Practical, pluggable types for a dynamic language, Comput. Lang. Syst. Struct. 35 (1) (2009) 48--62. Google Scholar
Digital Library
- F. Pluquet, A. Marot, R. Wuyts, Fast type reconstruction for dynamically typed programming languages, in: DLS '09: Proceedings of the 5th symposium on Dynamic languages, 2009, pp. 69--78. Google Scholar
Digital Library
- D. Ancona, M. Ancona, A. Cuni, N. D. Matsakis, Rpython: a step towards reconciling dynamically and statically typed oo languages, in: Proceedings of the 2007 symposium on Dynamic languages, DLS '07, 2007, pp. 53--64. Google Scholar
Digital Library
- C. Anderson, S. Drossopoulou, P. Giannini, Towards type inference for javascript, in: A. P. Black (Ed.), Proceedings of the 19th European Conference on Object-Oriented Programming (ECOOP 2005), no. 3586 in Lecture Notes in Computer Science, Springer-Verlag, Glasgow, UK, 2005, pp. 428--452. Google Scholar
Digital Library
- T. Wrigstad, F. Zappa Nardelli, S. Lebresne, J. Östlund, J. Vitek, Integrating typed and untyped code in a scripting language, in: POPL 2010, pp. 377--388. Google Scholar
Digital Library
- D. Herman, A. Tomb, C. Flanagan, Space-efficient gradual typing, Higher-Order and Sympolic Computation 23 (2) (2010) 167--189. Google Scholar
Digital Library
- J. Siek, P. Wadler, Threesomes, with and without blame, in: POPL 2010, pp. 365--376. Google Scholar
Digital Library
- Proceedings of the 18th European Symposium on Programming Languages and Systems (ESOP 2009), Vol. 5502 of Lecture Notes in Computer Science, Springer-Verlag, York, UK, 2009.Google Scholar
- Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages (POPL 2010), ACM Press, Madrid, Spain, 2010.Google Scholar
Index Terms
Cast insertion strategies for gradually-typed objects
Recommendations
Cast insertion strategies for gradually-typed objects
DLS '13: Proceedings of the 9th symposium on Dynamic languagesGradual typing enables a smooth and progressive integration of static and dynamic typing. The semantics of a gradually-typed program is given by translation to an intermediate language with casts: runtime type checks that control the boundaries between ...
Interpretations of the gradually-typed lambda calculus
Scheme '12: Proceedings of the 2012 Annual Workshop on Scheme and Functional ProgrammingGradual typing is an approach to integrating static and dynamic type checking within the same language [Siek and Taha 2006]. Given the name "gradual typing", one might think that the most interesting aspect is the type system. It turns out that the ...
Automatically generating the dynamic semantics of gradually typed languages
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesMany language designers have adopted gradual typing. However, there remains open questions regarding how to gradualize languages. Cimini and Siek (2016) created a methodology and algorithm to automatically generate the type system of a gradually typed ...







Comments