FORGOTTEN THE ALT... AGAIN: "A reactive object has two characteristics: the abandonment of all blocking operations and the unification of the concepts state and process. The former allows a reactive object to accept input from multiple sources without imposing any ordering on the input events." --- ??? YOU DON'T EVEN NEED ALT... ANY SELECT LOOP IN C CAN PROVE THAT YOU CAN ALLOW BLOCKING AND STILL NOT IMPOSE ANY ORDERING ON THE INPUT EVENTS !!!! Here's the pseudo-occam that shows it: PROC handler (CHAN a, b, aout, bout) WHILE TRUE ALT a ? astuff SEQ do a stuff with shared a-b resources aout ! astuff -- send to separate aProcess for private work b ? bstuff SEQ do b stuff with shared a-b resources bout ! bstuff -- send to separate bProcess for private work It assumes independent random input from outside through a and b, plus two other processes (aProcess and bProcess, not shown) that do any a and b work that does not require shared resources between a and b. Given that the shared resource stuff is small, the "reaction time" which is the ALT overhead + a ? astuff + do a stuff (in the case of a) is very small, so I think it's fair to call that reactive. This code does not need occam, and equivalently can be done in C with a select; but the occam is short and obvious (I hope). In case of bursts, the ALT can be made fair with a little extra work, not shown here, so that queued IO comes in in alternating order. REFERENCE: http://www.informatik.uni-freiburg.de/~wehr/software/haskell/ ... rhaskell Reactive objects are a convenient abstraction for writing programs which have to interact with a concurrent environment. A reactive object has two characteristics: the abandonment of all blocking operations and the unification of the concepts state and process. The former allows a reactive object to accept input from multiple sources without imposing any ordering on the input events. The latter prevents race conditions because the state of an object is only manipulated from the process belonging to the object. Only a few programming languages exist that make the concept of reactive objects available to programmers. Unfortunately, all those systems seem to be either not actively maintained anymore or not really matured yet. In this paper we demonstrate how reactive objects can be incorporated into the existing general purpose programming language Haskell by making use of common extensions to Haskell. Our implementation is heavily inspired by the O'Haskell programming language. While O'Haskell is a standalone programming language not compatible with Haskell, our implementation comes as a Haskell library that smoothly integrates the concept of reactive objects into the world of regular functional programming. Requirements: GHC 6.4 Available via darcs: darcs get --set-scripts-executable http://www.informatik.uni-freiburg.de/~wehr/darcs/rhaskell/ Send patches using darcs send to wehr@informatik.uni-freiburg.de Paper: Stefan Heimann and Matthias Neubauer Reactive Objects for Haskell Informal proceedings of the Fifth Symposium on Trends in Functional Languages (TFP 2004). Munich, Germany. November 2004. .ps.gz, .pdf, bibtex Last modified: 2008-03-03T11:40:16+01:00