On Thu, Nov 20, 2008 at 4:16 PM, islon <[EMAIL PROTECTED]> wrote: > > if you are a 100% sure that > your program is singlethreaded and will never > be multithread it's annoying all the ceremony to set a variable.
There are ways out of the box, if you want to get dirty. You can just call (def foo x) every time you want to update the value of foo. I believe that's atomic, so I suppose it's about as safe as using Scala's vars. But please don't resort to this until you've made a solid run at avoiding side effects in most of your code. The idea is that you shouldn't have to actually set the state very often, usually just once at the top level of any particular code path or even handler, which will have benefits even in a single-threaded system. It can be hard to think through algorithms this way at first, but I've found the experience to be rewarding in the long run. --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---