Published online by Cambridge University Press: 15 March 2011
We extend the simply typedλ-calculus with unbind and rebind primitiveconstructs. That is, a value can be a fragment of open code,which in order to be used should be explicitly rebound. Thismechanism nicely coexists with standard static binding. Themotivation is to provide an unifying foundation for mechanisms ofdynamic scoping, where the meaning of a name isdetermined at runtime, rebinding, such as dynamic updatingof resources and exchange of mobile code, and delegation,where an alternative action is taken if a binding is missing.Depending on the application scenario, we consider twoextensions which differ in the way type safety is guaranteed. Theformer relies on a combination of static and dynamic type checking.That is, rebind raises a dynamic error if for some variablethere is no replacing term or it has the wrong type. In the latter,this error is prevented by a purely static type system, at the priceof more sophisticated types.