This paper builds on the Scala delimited continuations mechanism and describes a set of reactive programming libraries. They describe some basic FRP primitives (for which they have helpfully selected new names, much like everyone else who treads this path): event sources and signals, along with a variety of useful combinators (e.g. merge, next, delay, etc.).
Per usual, everything is fitted nicely together through a combination of operator-like methods, implicit conversions and clever construction of the type hierarchy. In this case, the additional special sauce of delimited continuations is needed to allow data flow operations to capture and postpone the remainder of their computation when appropriate. Fortunately, this is almost entirely hidden from the user. An example of where it pokes its head up is in the inability to use an if
statement without a corresponding else
in CPS-transformed code, but what good functional programmer would do such a thing?
This is all packaged up into a framework called Scala.React which has remained tantalizingly unavailable to people not named Ingo Maier. I’m fairly convinced that this is the road forward for civilized UI programming, and likely for a variety of other domains. Thus, I look forward to getting my hands on the code and discovering that the glorious future is not as bright and shiny as it seemed in the brochure.