On Dec 5, 8:50 am, Julian Morrison <[EMAIL PROTECTED]> wrote: > It seems like a pure efficiency optimization - used alone it doesn't > change semantics from dosync and alter over one ref. > > It makes me feel wary. What if I changed my design and wanted to do > more in the same transaction? What if I later wanted to call a > function that uses it in the scope of a wider transaction? Or a > transaction that might retry? What if this was library code beyond my > power to alter? > > On the other hand I understand how it could be hugely simpler and > quicker, and sometimes an immediate synchronous change is the right > design. > > Perhaps it ought to have a warning sticker. "This is a side-effecting, > transaction-breaking blunt instrument contagious to any function that > calls it. Prefer using a ref, especially in library code". > Well, for most of its intended uses, it isn't that, and that advice doesn't hold. Take a memoization or similar cache - perfectly fine in a transaction. Or a one-time init - also fine. The ! is the sticker, I guess. Rich --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---