This version of Vestibule is read only. It represents an archive of the community effort to produce content for Ruby Manor 4.


This proposal by <a href="/users/aanand">Aanand Prasad</a> has been chosen by the community to be given at Ruby Manor 4.

updated over 7 years ago; latest suggestion over 7 years ago

Functional programming: the idea that won’t go away. We’ve been discussing it in the Ruby world ever since we learned how to collect, select and inject, and we still have barely any idea what we’re doing. If only we could just forget about it.

We can’t. It’s here again, and this time it wants our callbacks. In Functional Reactive Programming, instead of modelling state as mutable variables, we build programs out of (potentially infinite) streams of events and values, composing, mapping, filtering and reducing our way to solid, easy-to-reason-about code. At least, that’s the idea.

Does it work in practice? Does it make sense to model the world this way? What do we gain? What do we lose? Are we obscuring the intent of the code, or are we just too wrapped up in the imperative paradigm to recognise there are other ways of seeing? And—what on earth, is that a stream of functions?

The Ruby connection is admittedly tenuous here, as FRP is most relevant in the context of GUI programming (where input and output are constant and interleaved). I have a few ideas for example apps with which to demonstrate principles:

  • EventMachine-based server of some kind
  • Browser-based JavaScript/DOM app (ditching Ruby entirely)
  • RubyMotion app
  • Simple game (e.g. Pong)


  • B99daa9f050dfdcdc8f207aa3d0ea511 Tim Cowlishaw suggests over 7 years ago

    Hell yes. This sounds great! If you wanted to move away from GUI development as a motivating example, might I suggest that online algorithms (for eg analytics or data processing) might be an interesting area to apply FRP to? This isn't a specific request mind, just a suggestion if you're stuck for non-GUI ideas. I'd be very excited to hear about doing FRP with Ruby in general.

    Btw, also, have you seen Rubactive? it's an existing FRP implementation in Ruby.

  • The proposal author responds over 7 years ago

    Good call—I was just thinking that. Added to the list.

  • Be3698f145a80c1230fd667c87d0f0c8 Tom Stuart suggests over 7 years ago

    Yes please. Could you do something convincing in a traditionally async Ruby setting, e.g. with EventMachine? WebSockets? All that jazz?