Crossing state lines: adapting object-oriented frameworks to functional reactive languages

  • Authors:
  • Daniel Ignatoff;Gregory H. Cooper;Shriram Krishnamurthi

  • Affiliations:
  • Computer Science Department, Brown University;Computer Science Department, Brown University;Computer Science Department, Brown University

  • Venue:
  • FLOPS'06 Proceedings of the 8th international conference on Functional and Logic Programming
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

Functional reactive programming integrates dynamic dataflow with functional programming to offer an elegant and powerful model for expressing computations over time-varying values. Developing realistic applications, however, requires access to libraries, such as those for GUIs, that are written in mainstream object-oriented languages. Previous work has developed functional reactive interfaces for GUI toolkits but has not provided an account of the principles underlying the implementation strategy. In this paper, we investigate this problem by studying the adaptation of the object-oriented toolkit MrEd to the functional reactive language FrTime. The heart of this problem is how to communicate state changes between the application and the toolkit's widget objects. After presenting a basic strategy for adaptation, we discuss abstraction techniques based on mixins and macros that allow us to adapt numerous properties in many widget classes with minimal code duplication. This results in a wrapper for the entire MrEd toolkit in only a few hundred lines of code. We also briefly discuss a spreadsheet developed with the resulting toolkit.