UCSC-SOE-10-25: Virtual Values for Language Extension

Thomas H. Austin, Tim Disney, Cormac Flanagan
07/29/2010 09:00 AM
Computer Science
This paper focuses on extensibility: the ability of a programmer to use a particular language to extend the functionality and expressiveness of that language. This paper explores how to provide a useful and expressive notion of extensibility by virtualizing the interface between code and data. Specifically, a virtual value is a special kind of value. When a strict primitive operation expects a regular value but finds a virtual value in its place, that operation invokes a trap on the virtual value. Each virtual value contains a collection of traps, each of which is a user-defined function that describes how that operation should behave on that kind of value, and so provides a very general form of behavioral intercession.

This paper formalizes the semantics of virtual values, and shows how virtual values enable the definition of a variety of language extensions, each under 50 lines of code. These extensions include additional numeric types; delayed evaluation; taint tracking; contracts; revokable membranes; dynamic information flow; and symbolic execution.

Several of these topics are areas of active research. We suggest that universal proxies may enable such research to be performed by experimenting within a language with extensible virtual values, rather than by having to define new programming languages and implementations.

UCSC-SOE-10-25