Skip to content
Ross Angle edited this page Apr 8, 2014 · 1 revision

You may have heard of functional reactive programming, aka FRP, which has recently been gaining in popularity in the form of simple functional programming libraries that manipulate time-varying signals. A promising variation by David Barbour is RDP (reactive demand programming), which eschews all instantaneous events and makes all statefulness external to the program, making it more seamless with the continuous-time, stateful behavior of the outside world. A separate development is the arrow calculus, a notation where a program's local variables can actually represent the abstract flow of pipelines like these, rather than representing concrete first-class data structures.

For now, Era approaches the topic of reactive programming through its Penknife language. Penknife is mostly imperative, but it has two features that make it well-suited to programming in reactive paradigms:

Programmatic aliasing: In Penknife, variables hold first-class values, but these values are not automatically aliased when the variable occurs more than once. Instead the value is deeply copied into multiple values. Some of its leaves may simply be aliased, and some of them may invoke special duplication behavior. This behavior may leave an activity log that can be reconstructed into another program, which itself may be reactive, statically typed, concurrent, etc. This makes Penknife a nice platform for making language prototypes or DSLs with exotic semantics.

Effects represented as first-class capabilities: Penknife's effect system is built on object capabilities. The object-capability model achieves good security for code mashups, but Penknife throws that all away by letting the programmer stuff all their capabilities into a context value that's implicitly passed throughout the program. This makes Penknife extraordinarily convenient for low-security programming idioms, while making it easy enough to do secure mashups and pure FP when it matters.

Clone this wiki locally