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.
This work is partially supported by NSF grant CCR-0305949.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Bachrach, J., Playford, K.: The Java syntactic extender. In: ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages & Applications, pp. 31–42 (2001)
Bracha, G., Cook, W.: Mixin-based inheritance. In: ACM SIGPLAN Conference on Object- Oriented Programming Systems, Languages & Applications, pp. 303–311 (1990)
Cooper, G.H., Krishnamurthi, S.: Embedding dynamic dataflow in a call-by-value language. In: Sestoft, P. (ed.) ESOP 2006. LNCS, vol. 3924, pp. 294–308. Springer, Heidelberg (2006)
Courtney, A., Elliott, C.: Genuinely functional user interfaces. In: Haskell Workshop (2001)
Eckstein, R., Loy, M., Wood, D.: Java Swing. O’Reilly, Sebastopol (1997)
Elliott, C., Hudak, P.: Functional reactive animation. In: ACM SIGPLAN International Conference on Functional Programming, pp. 263–277 (1997)
Findler, R.B., Clements, J., Flanagan, C., Flatt, M., Krishnamurthi, S., Steckler, P., Felleisen, M.: DrScheme: A programming environment for Scheme. Journal of Functional Programming 12(2), 159–182 (2002)
Flatt, M., Findler, R.B., Krishnamurthi, S., Felleisen, M.: Programming languages as operating systems (or, Revenge of the Son of the LispMachine). In: ACM SIGPLAN International Conference on Functional Programming, pp. 138–147 (1999)
Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and mixins. In: ACM SIGPLANSIGACT Symposium on Principles of Programming Languages, pp. 171–183 (1998)
Kohlbecker Jr., E.E.: Syntactic Extensions in the Programming Language Lisp. PhD thesis, Indiana University (1986)
Myers, B.A., Giuse, D.A., Dannenberg, R.B., Kosbie, D.S., Pervin, E., Mickish, A., Zanden, B.V., Marchal, P.: Garnet: Comprehensive support for graphical, highly interactive user interfaces. Computer 23(11), 71–85 (1990)
Myers, B.A., McDaniel, R.G., Miller, R.C., Ferrency, A.S., Faulring, A., Kyle, B.D., Mickish, A., Klimovitsk, Doane, P.: The Amulet environment: New models for effective user interface software development. IEEE Transactions on Software Engineering 23(6), 347–365 (1997)
Nilsson, H., Courtney, A., Peterson, J.: Functional reactive programming, continued. In: ACM SIGPLAN Workshop on Haskell, pp. 51–64 (2002)
Sage, M.: FranTk: A declarative GUI language for Haskell. In: ACM SIGPLAN International Conference on Functional Programming, pp. 106–117 (2000)
Schärli, N., Ducasse, S., Nierstrasz, O., Black, A.P.: Traits: Composable units of behavior. In: European Conference on Object-Oriented Programming, pp. 248–274 (2003)
Sheard, T., Jones, S.P.: Template meta-programming for haskell. In: Proceedings of the ACM SIGPLAN workshop on Haskell, pp. 1–16 (2002)
VanHilst, M., Notkin, D.: Using C++ templates to implement role-based designs. In: International Symposium on Object Technologies for Advanced Software, pp. 22–37 (1996)
Weise, D., Crew, R.: Programmable syntax macros. In: ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 156–165 (1993)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Ignatoff, D., Cooper, G.H., Krishnamurthi, S. (2006). Crossing State Lines: Adapting Object-Oriented Frameworks to Functional Reactive Languages. In: Hagiya, M., Wadler, P. (eds) Functional and Logic Programming. FLOPS 2006. Lecture Notes in Computer Science, vol 3945. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11737414_18
Download citation
DOI: https://doi.org/10.1007/11737414_18
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-33438-5
Online ISBN: 978-3-540-33439-2
eBook Packages: Computer ScienceComputer Science (R0)