Immediate mode UI programming is based on continually drawing the UI in a render loop, handling events in between frames using ordinary control-flow. This supports straightforward understanding and debugging of UI code, without inversion of control. In this paper I present TwoStones, a simple DSL for immediate mode Web UI programming in a purely functional style: it presumes a single, immutable application model which is updated functionally through the use of cursors (a kind of zipper). Relying only on immutable data means that time-travel debugging and undo-facilities are easy to implement. For exposition purposes, the semantics of TwoStones is first decomposed in two parts: one semantics for rendering, and one semantics for event handling. Finally, they are merged again for better performance. A number of examples show the potential of the approach.

Tue 4 Apr

Displayed time zone: Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna change