

How Clojure deals with objects - coding4all
https://gist.github.com/runexec/786b92b97b5a3a0ffac7

======
raspasov
One important point is that once you instantiate like this (def a (ABC.
"Roger")) the "name" property is immutable by default, which is different from
most OOP languages where you'd have to mark the property as "final" or
something like that. If you really need mutable properties you'd have to use
deftype instead of defrecord and mark the property with a the proper hint as
described here
[https://clojuredocs.org/clojure.core/deftype](https://clojuredocs.org/clojure.core/deftype)
. In most cases, unless you're building a low level data structure, mutable
properties are not needed; they are harder to reason about and much harder to
get right in the face of concurrency and multiple threads.

------
nickik
For those that want to go a bit deeper, prismatic has a information sheet.

See: [https://github.com/Prismatic/eng-
practices/blob/master/cloju...](https://github.com/Prismatic/eng-
practices/blob/master/clojure/20130926-data-representation.md)

~~~
mateuszf
This is very informative, thank you.

