Hostname: page-component-77f85d65b8-2tv5m Total loading time: 0 Render date: 2026-04-22T16:27:32.799Z Has data issue: false hasContentIssue false

The ins and outs of Clean I/O

Published online by Cambridge University Press:  07 November 2008

Peter Achten
Affiliation:
Computing Science Institute, University of Nijmegen, 1 Toernooiveld, 6525ED, Nijmegen, The Netherlands (e-mail: peter88@cs.kun.nl)
Rinus Plasmeijer
Affiliation:
Computing Science Institute, University of Nijmegen, 1 Toernooiveld, 6525ED, Nijmegen, The Netherlands (e-mail: peter88@cs.kun.nl)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the 'Save PDF' action button.

Functional programming languages have banned assignment because of its undesirable properties. The reward of this rigorous decision is that functional programming languages are side-effect free. There is another side to the coin: because assignment plays a crucial role in Input/Output (I/O), functional languages have a hard time dealing with I/O. Functional programming languages have therefore often been stigmatised as inferior to imperative programming languages because they cannot deal with I/O very well. In this paper, we show that I/O can be incorporated in a functional programming language without loss of any of the generally accepted advantages of functional programming languages. This discussion is supported by an extensive account of the I/O system offered by the lazy, purely functional programming language Clean. Two aspects that are paramount in its I/O system make the approach novel with respect to other approaches. These aspects are the technique of explicit multiple environment passing, and the Event I/O framework to program Graphical User I/O in a highly structured and high-level way. Clean file I/O is as powerful and flexible as it is in common imperative languages (one can read, write, and seek directly in a file). Clean Event I/O provides programmers with a high-level framework to specify complex Graphical User I/O. It has been used to write applications such as a window-based text editor, an object based drawing program, a relational database, and a spreadsheet program. These graphical interactive programs are completely machine independent, but still obey the look-and-feel of the concrete window environment being used. The specifications are completely functional and make extensive use of uniqueness typing, higher-order functions, and algebraic data types. Efficient implementations are present on the Macintosh, Sun (X Windows under Open Look) and PC (OS/2).

Information

Type
Articles
Copyright
Copyright © Cambridge University Press 1995
Submit a response

Discussions

No Discussions have been published for this article.