• silasmariner@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    A propos, I actually find that the biggest win of FP is somewhat orthogonal to it, and that’s immutability. This leads to the ability to reason locally about code which is IMO completely invaluable even outside of parallelism scenarios. When you don’t know if a method might be mutating a parameter without actually reading all the way down it’s a real PITA 😅 (I have been doing a lot of refactoring of a large codebase recently and this has been a serious issue)

    • azthec@feddit.nlOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      For sure, this has been something I learned from working in Scala that has made my code in other projects much more readable and easier to reason about. For performance reasons I may need to use mutables, but often I can keep it in the context of the function and just encapsulate it.