Virtual values for language extension

TH Austin, T Disney, C Flanagan - Proceedings of the 2011 ACM …, 2011 - dl.acm.org
Proceedings of the 2011 ACM international conference on Object oriented …, 2011dl.acm.org
This paper focuses on extensibility, the ability of a programmer using a particular language
to extend the expressiveness of that language. This paper explores how to provide an
interesting notion of extensibility by virtualizing the interface between code and data. A
virtual value is a special value that supports behavioral intercession. When a primitive
operation is applied to a virtual value, it invokes a trap on that virtual value. A virtual value
contains multiple traps, each of which is a user-defined function that describes how that …
This paper focuses on extensibility, the ability of a programmer using a particular language to extend the expressiveness of that language. This paper explores how to provide an interesting notion of extensibility by virtualizing the interface between code and data. A virtual value is a special value that supports behavioral intercession. When a primitive operation is applied to a virtual value, it invokes a trap on that virtual value. A virtual value contains multiple traps, each of which is a user-defined function that describes how that operation should behave on that value. This paper formalizes the semantics of virtual values, and shows how they enable the definition of a variety of language extensions, including additional numeric types; delayed evaluation; taint tracking; contracts; revokable membranes; and units of measure. We report on our experience implementing virtual values for Javascript within an extension for the Firefox browser.
ACM Digital Library