4 ms·
What you do mean by making you use objects under the hood? Are you referring to calling into 3rd party Java libraries or the implementation details of Clojure
by fulafel 6y ago
What you do mean by making you use objects under the hood? Are you referring to calling into 3rd party Java libraries or the implementation details of Clojure data structures that are under the hood?
If the former, the usual thing in Clojure is to make an abstraction layer for them that doesn't leak mutability into your code (or just skipping those libraries altogether if that doesn't work). But of course some things are just inherently side-effectful anyways, where you have to be mindful to isolate/refactor things like IO the edges of the system.
(And yep to echo a sibling comment, Clojure is not a purely functional language, and doesn't pretend to be one)
- holtalanm 6y ago> What you do mean by making you use objects under the hood? im referring to, at runtime, literally _every_ data structure you use in Clojure is an object.
- lbj 6y agoThat doesn't make Clojure any less functional. No matter which language you use, eventually it'll compile to machinecode and thats imperative by nature. Your code however, can be whatever it wants to be. In certain scenarios, the object boxing does come with a high pricetag in terms of performance, but there are always ways around it and usually only a few functions need tweaking. I will concede however, that those few functions typically end up losing their elegance.
- fulafel 6y agoYou ar going to have to stick to FP theory and stand back from computers if semantically invisible mutability under the hood disturbs you a lot.