I have been working recently with Clojure's types and records recently, and I was wondering if these are very new concepts, or are they inspired by the Common Lisp Object System?
I believe they are pretty much new innovations within Clojure.
CLOS is a fairly complex, fully featured object oriented system. It features various OOP techniques you often hear mentioned and which exist in other object oriented languages - multiple inheritance, dynamic dispatch, generic functions etc.
Clojure takes a different approach - types and records are much simpler than full OOP and are not intended to constitute a full OOP system. Rather, I understand that the design is motivated by:
If you want a traditional object oriented system like CLOS, it would be possible to build this in Clojure on on top of types and records. You can also use Java-style object orientation directly within Clojure. However I believe it's not usually recommended by Clojure experts - Clojure usually offers you different or better ways to solve the same problems.
In general - Clojure tends to provide you with "simple" tools that you can compose to solve the problem at hand, rather than prescribing a complex framework at any point. It's an interesting philosophy discussed at some length in this video by Stuart Halloway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With