4 ms·
People say Clojure is super functional, but here's an OOP based library. In my experience learning to program with immutability was the trickiest challange to
by escherize 11y ago
People say Clojure is super functional, but here's an OOP based library. In my experience learning to program with immutability was the trickiest challange to overcome when learning Clojure. I had worked with C++ in college, then js/python in industry for a couple years before I took an interest in Clojure, so I didn't use many const features in C++. Possibly like most programmers, I was used to mutation-by-default.
- weavejester 11y agoWhy do you think it's an OOP based library?
- nikki93 11y agoFunctional and OOP the way you seem to be thinking about them aren't necessarily at odds. If you don't immutably update objects and instead do 'return-the-updated-object' then it could fit in with functional. They seem to do this often in Haskell libraries for example. The weird thing is the notion of identity across OOP and Functional--you can have shared handles to an underlying object modified by separate code in traditional OOP. Mixing paradigms is interesting. My favorite is to not do class-based object oriented, but prototype-based instead, with multiple parents like in Self. I wonder how that would combine with immutable objects.
- wtetzner 11y agoI'm not sure why you think it's OO. The library doesn't do any mutation. The "setter" functions return new "updated" versions of the URI, leaving the original untouched.