Abstract
Gradual typing enables both static and dynamic typing in the same program and makes it convenient to migrate code regions between the two typing disciplines. One goal of gradual typing is to provide all the benefits of static typing, such as efficiency, in statically-typed regions. However, this goal is elusive: the standard approach to mutable references imposes run-time overhead in statically-typed regions and alternative approaches are too conservative, either statically or at run-time. In this paper we present a new semantics called monotonic references which imposes none of the run-time overhead of dynamic typing in statically typed regions. With this design, casting a reference may cause a heap cell to become more statically typed (but not less). Retaining type safety is challenging with strong updates to the heap. Nevertheless, we have a mechanized proof of type safety. Further, we present blame tracking for monotonic references and prove a blame theorem.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Abadi, M., Cardelli, L., Pierce, B., Plotkin, G.: Dynamic typing in a statically-typed language. In: Symposium on Principles of programming languages (1989)
Bierman, G., Meijer, E., Torgersen, M.: Adding dynamic types to C#. In: European Conference on Object-Oriented Programming (2010)
Boyland, J.T.: The problem of structural type tests in a gradual-typed language. In: Foundations of Object Oriented Languages, FOOL 2014, pp. 675–681. ACM (2014)
Fähndrich, M., Leino, K.R.M.: Heap monotonic typestate. In: International Workshop on Alias Confinement and Ownership (2003)
Findler, R.B., Felleisen, M.: Contracts for higher-order functions. In: International Conference on Functional Programming, ICFP, pp. 48–59 (2002)
Flatt, M.: The Racket reference 6.0. Technical report, PLT Inc (2014), http://docs.racket-lang.org/reference/index.html
Henglein, F.: Dynamic typing: syntax and proof theory. Science of Computer Programming 22(3), 197–230 (1994)
Herman, D., Tomb, A., Flanagan, C.: Space-efficient gradual typing. In: Trends in Functional Prog (TFP), p. XXVIII (April 2007)
Rastogi, A., Swamy, N., Fournet, C., Bierman, G., Vekris, P.: Safe & efficient gradual typing for TypeScript. Technical Report MSR-TR-2014-99 (2014)
Siek, J.G., Taha, W.: Gradual typing for functional languages. In: Scheme and Functional Programming Workshop, pp. 81–92 (September 2006)
Siek, J.G., Vitousek, M.M.: Monotonic references for gradual typing. In: Computing Research Repository (2013), http://arxiv.org/abs/1312.0694
Siek, J.G., Wadler, P.: Threesomes, with and without blame. In: Symposium on Principles of Programming Languages, POPL, pp. 365–376 (January 2010)
Siek, J.G., Vitousek, M.M., Cimini, M., Boyland, J.T.: Refined criteria for gradual typing. Under review for publication at SNAPL 2015 (2015)
Strickland, T.S., Tobin-Hochstadt, S., Findler, R.B., Flatt, M.: Chaperones and impersonators: run-time support for reasonable interposition. In: OOPSLA (2012)
Swamy, N., Fournet, C., Rastogi, A., Bhargavan, K., Chen, J., Strub, P.-Y., Bierman, G.: Gradual typing embedded securely in JavaScript. In: Symposium on Principles of Programming Languages, POPL (January 2014)
Tobin-Hochstadt, S., Felleisen, M.: Interlanguage migration: From scripts to programs. In: Dynamic Languages Symposium (2006)
Vitousek, M.M., Siek, J.G., Kent, A., Baker, J.: Design and evaluation of gradual typing for Python. In: Dynamic Languages Symposium (2014)
Wadler, P., Findler, R.B.: Well-typed programs can’t be blamed. In: European Symposium on Programming, ESOP, pp. 1–16 (March 2009)
Wrigstad, T., Nardelli, F.Z., Lebresne, S., Östlund, J., Vitek, J.: Integrating typed and untyped code in a scripting language. In: Symposium on Principles of Programming Languages, POPL, pp. 377–388 (2010)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2015 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Siek, J.G., Vitousek, M.M., Cimini, M., Tobin-Hochstadt, S., Garcia, R. (2015). Monotonic References for Efficient Gradual Typing. In: Vitek, J. (eds) Programming Languages and Systems. ESOP 2015. Lecture Notes in Computer Science(), vol 9032. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-46669-8_18
Download citation
DOI: https://doi.org/10.1007/978-3-662-46669-8_18
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-662-46668-1
Online ISBN: 978-3-662-46669-8
eBook Packages: Computer ScienceComputer Science (R0)