I largely agree with your summary (except did you mean swap! instead of set! ?). I also freely admit I was in the guilty group who used re-def to manage state; however the reason we did this was because we didn't know any better. I'd use atoms for the same task now.
I'd add:
* atoms are updated atomically and don't suffer the lost update problem, provided you use swap! and not reset! Avoiding lost updates is a core part of all of clojure's concurrent state variables: atoms, refs and agents all provide means to avoid lost updates, largely through using functions to transform current state into new state. Vars do not share this property.
* vars (the stateful variables created by def) provide access to thread-local storage by using dynamic rebinding (the #'binding macro).
* re-deffing of vars is something which I only really use for repl-based programming. The fact that I can rebind a var means that I can interactively replace a broken function or refactor a messy one. But I wouldn't want to programmatically re-def anything.
Phil
--
You received this message because you are subscribed to the Google Groups "London Clojurians" group.
To view this discussion on the web visit https://groups.google.com/d/msg/london-clojurians/-/jMzM0p555qAJ.
To post to this group, send email to london-c...@googlegroups.com.
To unsubscribe from this group, send email to london-clojuri...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/london-clojurians?hl=en.