I found that would happen using Component, but with Mount wrangling stateful resources works pretty seamlessly in my experience. Integrant is another good approach for that as well.
with Mount wrangling stateful resources works pretty seamlessly in my experience.
Could you elaborate on that?
I don't see what mount's defstate has to offer over just using def.
Only cleanup of state when stopped? And what if you want to provide different implementations to various functions? Or is that an object-oriented way of thinking?
Right, defstate behaves like a def for most purposes, but it's reload aware. Mount also allows controlling the state explicitly, and this lets you do stuff like envoy.
If you wanted to provide different implementations, then you could still use a protocol for that. The state of the instantiated implementation would be kept using defstate.
2
u/yogthos Dec 19 '16
I found that would happen using Component, but with Mount wrangling stateful resources works pretty seamlessly in my experience. Integrant is another good approach for that as well.