1. 1
  1.  

  2. 4

    Life is just so much easier when your unit of computation is a function. Building up to something like an object is obvious with functions and where to place functionality that is doing pure data transformations is clear. The value of doing pure data transformations is also becoming clear. I think OOP is really crippling when it comes to this type of work.

    1. 2

      Can you elaborate a little on this? Coming from a mostly OO (or just procedural) programming background, I’m curious how you would build from functions up to something like objects.

      1. 3

        An object is a tuple consisting of an opaque state and a dispatch table. So building this with functions is simply building that tuple. The common solution would be to build a record where each entry is a function (corresponding to a method) and each function is a closure wrapping the state.