I want to implement transient
and persistent!
in my Clojure deftype. As far as I can tell, this means having another deftype, TransientMyThing, implement the necessary methods. Okay so far, but those two classes need to know about each other in order to return instances of each other.
I think I can do it by forward-declaring Clojure functions make-transient and make-persistent, then defining the deftype (by referring to that function), then implementing the functions with the now-existing types, but it seems pretty gross to me. Is there a better option?
Edit: that works, but it's still gross.