• Zagorath@aussie.zone
    link
    fedilink
    arrow-up
    40
    ·
    11 hours ago

    Nothing wrong with classes in functional programming though. Just return a new instance of the class from your method, rather than mutating an existing instance.

    • xmunk@sh.itjust.works
      link
      fedilink
      arrow-up
      4
      ·
      4 hours ago

      Javascript:

      I heard you like mutating class data so I’m mutating the data you can put in your class data, dawg.

    • Amon@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      3 hours ago

      Classes are just another way to define an object. Heck even Lisp has objects!

    • frezik@midwest.social
      link
      fedilink
      arrow-up
      11
      ·
      edit-2
      8 hours ago

      Right, I think the two aren’t as different as they appear. You can think of a closure as an object with just one method.

      If OO programming is fundamentally about objects sending messages to each other, then there are many ways to approach that. Some of those ways are totally compatible with functional programming.

      The legacy of C++ has dominated what OOP is “supposed” to be, but it doesn’t have to work like that.