On Wed, Dec 31, 2008 at 6:27 AM, Rich Hickey <richhic...@gmail.com> wrote: > I also think that your use cases for atoms for local mutation are a > mismatch. atoms are about sharing. You really want something else for > private/local mutable references, and I have some ideas for that.
You're right that I'm basically asking for something that works well for private/local mutable references. It's possible right now to use with-local-vars, or atoms, or refs, but none of them quite fill that need perfectly (by design). My impression so far of atoms is that they are "underpowered", and suitable for a very small set of use cases, most of which you could have already done with refs and commute (albeit with a slight performance penalty). Since atoms are side-effecting, their composability with other transaction-based Clojure code is limited. Yes, my feelings about this are entirely theoretical, and maybe in practice, as more and more Clojure code is written, I'll get to see more good uses for atoms. That's part of the fun of working with a new and vibrant language that is full of possibilities. But this perception I have is why I like the idea of extending atom's capabilities to cover the local mutable reference use cases. I like the idea of thinking of an atom as a simple box, with a cool bonus feature of being able to atomically swap its contents, providing a step up in safety without going as far as a ref. Anyway, it's great to hear you have some more ideas on the subject, and I look forward to seeing what you come up with. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---