Advertisement

Crossing State Lines: Adapting Object-Oriented Frameworks to Functional Reactive Languages

  • Daniel Ignatoff
  • Gregory H. Cooper
  • Shriram Krishnamurthi
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3945)

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.

Keywords

Functional Programming Standard Property Event Source Event Stream Method Invocation 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Bachrach, J., Playford, K.: The Java syntactic extender. In: ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages & Applications, pp. 31–42 (2001)Google Scholar
  2. 2.
    Bracha, G., Cook, W.: Mixin-based inheritance. In: ACM SIGPLAN Conference on Object- Oriented Programming Systems, Languages & Applications, pp. 303–311 (1990)Google Scholar
  3. 3.
    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)CrossRefGoogle Scholar
  4. 4.
    Courtney, A., Elliott, C.: Genuinely functional user interfaces. In: Haskell Workshop (2001)Google Scholar
  5. 5.
    Eckstein, R., Loy, M., Wood, D.: Java Swing. O’Reilly, Sebastopol (1997)Google Scholar
  6. 6.
    Elliott, C., Hudak, P.: Functional reactive animation. In: ACM SIGPLAN International Conference on Functional Programming, pp. 263–277 (1997)Google Scholar
  7. 7.
    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)CrossRefMATHGoogle Scholar
  8. 8.
    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)Google Scholar
  9. 9.
    Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and mixins. In: ACM SIGPLANSIGACT Symposium on Principles of Programming Languages, pp. 171–183 (1998)Google Scholar
  10. 10.
    Kohlbecker Jr., E.E.: Syntactic Extensions in the Programming Language Lisp. PhD thesis, Indiana University (1986)Google Scholar
  11. 11.
    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)CrossRefGoogle Scholar
  12. 12.
    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)CrossRefGoogle Scholar
  13. 13.
    Nilsson, H., Courtney, A., Peterson, J.: Functional reactive programming, continued. In: ACM SIGPLAN Workshop on Haskell, pp. 51–64 (2002)Google Scholar
  14. 14.
    Sage, M.: FranTk: A declarative GUI language for Haskell. In: ACM SIGPLAN International Conference on Functional Programming, pp. 106–117 (2000)Google Scholar
  15. 15.
    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)Google Scholar
  16. 16.
    Sheard, T., Jones, S.P.: Template meta-programming for haskell. In: Proceedings of the ACM SIGPLAN workshop on Haskell, pp. 1–16 (2002)Google Scholar
  17. 17.
    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)Google Scholar
  18. 18.
    Weise, D., Crew, R.: Programmable syntax macros. In: ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 156–165 (1993)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Daniel Ignatoff
    • 1
  • Gregory H. Cooper
    • 1
  • Shriram Krishnamurthi
    • 1
  1. 1.Computer Science DepartmentBrown UniversityUSA

Personalised recommendations