Hostname: page-component-6b989bf9dc-476zt Total loading time: 0 Render date: 2024-04-14T09:06:32.184Z Has data issue: false hasContentIssue false

Type safe incremental rebinding

Published online by Cambridge University Press:  15 May 2015

DIBRIS, Università di Genova, Genova, Italy
CS Institute, DISIT, Università del Piemonte Orientale, Alessandria, Italy
DIBRIS, Università di Genova, Genova, Italy


We extend the simply-typed lambda-calculus with a mechanism for dynamic and incremental rebinding of code. Fragments of open code which can be dynamically rebound are values. Differently from standard static binding, which is done on a positional basis, rebinding is done on a nominal basis, that is, free variables in open code are associated with names which do not obey α-equivalence. Moreover, rebinding is incremental, that is, just a subset of names can be rebound, making possible code specialization, and rebinding can even introduce new names. Finally, rebindings, which are associations between names and terms, are first-class values, and can be manipulated by operators such as overriding and renaming. We define a type system in which the type for a rebinding, in addition to specify an association between names and types (similarly to record types), is also annotated. The annotation says whether or not the domain of the rebinding having this type may contain more names than the ones that are specified in the type. We show soundness of the type system.

Copyright © Cambridge University Press 2015 

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)


Ancona, D., Giannini, P. and Zucca, E. (2013). Reconciling positional and nominal binding. In: Graham-Lengrand, S. and Paolini, L. (eds.) ITRS'12 - Intersection types and Related Systems. Available at: Scholar
Ancona, D. and Moggi, E. (2004). A fresh calculus for name management. In: GPCE'04. Springer Lecture Notes in Computer Science 3286 206224.CrossRefGoogle Scholar
Ancona, D. and Zucca, E. (2002). A calculus of module systems. Journal of Functional Programming 12 (2) 91132.CrossRefGoogle Scholar
Bierman, G., Hicks, M. W., Sewell, P., Stoyle, G. and Wansbrough, K. (2003). Dynamic rebinding for marshalling and update, with destruct-time λ. In: ICFP'03, ACM Press 99110.CrossRefGoogle Scholar
Dami, L. (1997). A lambda-calculus for dynamic binding. Theoretical Computer Science 192 (2) 201231.CrossRefGoogle Scholar
Dezani-Ciancaglini, M., Giannini, P. and Zucca, E. (2010). Intersection types for unbind and rebind. In: Pimentel, E., Venneri, B. and Wells, J. (eds.) ITRS'10 - Intersection Types and Related Systems. Electronic Proceedings in Theoretical Computer Science 45 4558.CrossRefGoogle Scholar
Dezani-Ciancaglini, M., Giannini, P. and Zucca, E. (2011). Extending the lambda-calculus with unbind and rebind. RAIRO - Theoretical Informatics and Applications 45 (1) 143162.CrossRefGoogle Scholar
Felleisen, M. and Friedman, D. P. (1986). Control operators, the SECD-machine, and the lambda-calculus. In: 3rd Working Conference on the Formal Description of Programming Concepts, Ebberup, Denmark 193–219.Google Scholar
Glück, R. and Jørgensen, J. (1995). Efficient multi-level generating extensions for program specialization. In: PLILP 259–278.Google Scholar
Lagorio, G., Servetto, M. and Zucca, E. (2012). Featherweight Jigsaw - replacing inheritance by composition in Java-like languages. Information and Computation 214 86111.CrossRefGoogle Scholar
Moreau, L. (1998). A syntactic theory of dynamic binding. Higher-Order and Symbolic Computation 11 (3) 233279.CrossRefGoogle Scholar
Nanevski, A. (2003). From dynamic binding to state via modal possibility. In: PPDP'03, ACM 207–218.Google Scholar
Nanevski, A. and Pfenning, F. (2005). Staged computation with names and necessity. Journal of Functional Programming 15 (5) 893939.CrossRefGoogle Scholar
Rémy, D. (1993). Type inference for records in a natural extension of ML. In: Gunter, C. A. and Mitchell, J. C. (eds.) Theoretical Aspects of Object-Oriented Programming, MIT Press.Google Scholar
Taha, W. and Sheard, T. (2000). MetaML and multi-stage programming with explicit annotations. Theoretical Computer Science 248 (1–2) 211242.CrossRefGoogle Scholar
Tanter, E. (2009). Beyond static and dynamic scope. In: Dynamic Languages Symposium'09, ACM Press 314.CrossRefGoogle Scholar