I was thinking about the well known idea of connecting to a REPL in a
production system and fixing things on the fly without downtime. Rich
talks about this in his presentations.

I am kind of embarrassed to ask this, but is there a "correct way" to
do this . Do you simply re-def a function, e.g., to time execution:

(def old-f f)
(defn f [] (time old-f))

Under which conditions (e.g. which kind of Java interoperability) is
this thread safe? Supposing only clojure functions are calling f; it
would be thread safe, right?

Or should one anticipate this up front by making f a ref, e.g.,
supposing the production program has

(def f (ref (fn [x] x)))

we open the repl and do e.g.

(def old-f @f)
(dosync (ref-set f (fn [x] (time (old-f x)))))

Coming from a Java concurrency background I guess I am trying to
understand the concurrency semantics of def in terms of the Java
model.

Liking clojure more every hour ;-)

/krukow
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to