>> ... `setq` though (a feature not present in Clojure...
I am not familiar with elisp but from first google result it reads that the equivalent is alter! / swap!.
I am not familiar with elisp but from first google result it reads that the equivalent is alter! / swap!.
(deftype SomeTypeWithMutableFields [^:unsynchronized-mutable some-mutable-field ^:volatile-mutable another-mutable-field])
:unsynchronized-mutable corresponds to a normal mutable Java variable, and :volatile-mutable corresponds to a Java variable with the volatile modifier.
They are private by default, you can only set! them within the lexical scope of the deftype definition. If you needed to expose fast host mutation to the public, I would create a setter/getter interface (via definterface) and implement it on your deftype and use set! locally to mutate the field there.