Functional Reactive Programming

27 thoughts
last posted Sept. 9, 2015, 6:02 a.m.
0

I/O Operations as Result Objects

Interesting approach to I/O for FRP from discussion with +Shriram Krishnamurti and reading this paper:

http://cs.brown.edu/~sk/Publications/Papers/Published/ick-adapt-oo-fwk-frp/paper.pdf

Basically the idea is that the UI would have an invisible widget to represent files, the console, or network resources. The widgets are defined outside the system.

The FRP program can use the properties of the input widgets to "read". The FRP program can specify the properties of the output widgets to "write" or possibly initiate a read.

So in an FRP program responsible for yielding a scene graph, the resulting scene graph may include these invisible objects that specify any I/O operations that should be in progress.

These invisible scene objects would have some sort of static identity the FRP program uses for continuity between updates.

Alternatively, the FRP program can return the I/O graph separately.

In a streaming context (like the console or a network stream) you could have a read/write property of such a widget representing the current output buffer. The runtime drains the buffer between updates. There can also be an input buffer which the runtime fills between updates. Thus the widget need not maintain the entire history of input and output.

Also, if a particular file or socket disappears from the list of I/O activities, the runtime can close it.

26 later thoughts