Embedding Dynamic Dataflow in a Call-by-Value Language Gregory H. Cooper and Shriram Krishnamurthi Brown University, Providence, RI 02912, USA {greg, sk}@cs.brown.edu Abstract. This paper describes FrTime, an extension of Scheme designed for writing interactive applications. Inspired by functional reactive programming, the language embeds dynamic dataflow within a call-by-value functional language. The essence of the embedding is to make program expressions evaluate to nodes in a dataflow graph. This strategy eases importation of legacy code and permits in- cremental program construction. We have integrated FrTime with the DrScheme programming environment and have used it to develop several novel applications. We describe FrTime’s design and implementation in detail and present a formal semantics of its evaluation model. 1 Introduction This paper describes FrTime (pronounced “father time”), a programming language built atop the DrScheme environment [9]. FrTime is an exploration of an important point in the design space of dynamic dataflow, or functional reactive [7, 16, 19], programming. To make FrTime as familiar as possible to current programmers, the language reuses much of the infrastructure, including the syntax, of an existing call-by-value language. In this case the host language is a purely functional subset of Scheme, although the strategy we describe could be applied to other call-by-value languages as well. The embedding strategy reuses the host language’s evaluator to make program execution construct a graph of dataflow dependencies; a dataflow engine subsequently reacts to events and propagates changes through this graph. FrTime conservatively extends basic language constructs to trigger graph creation when used in the context of time-varying values. Pure Scheme programs are also FrTime programs with the same meaning they have in Scheme and may be incorporated into FrTime programs without modification. The design of FrTime reflects a desire to satisfy three main goals. 1. Programs should be able to respond to and process events from external sources. For example, one application of FrTime is as a scripting language for a debugger [15]. A debugger script must respond to events from the program under investigation, which arrive at an unspecified frequency that cannot be known a priori. This suggests that the language should embrace a push-driven implementation strategy, where the arrival of an event triggers a computation that propagates up a tree of dependencies. 2. FrTime programs should be able to make maximal use of a programming envi- ronment for incremental development. This especially means that programmers must This work is partially supported by NSF grant CCR-0305949.