I just put together some example code to demonstrate "hot updates"
with Clojure.

http://paste.lisp.org/display/86576

It allows you to connect to a REPL via port 12345 and dynamically
update things as necessary. To address the issue of updating multiple
definitions at once, you'd do something like the following (after
modifying main.clj):

tra...@travis-desktop:~$ nc localhost 12345
clojure.core=> (require 'main :reload)

Right now the main thread simply prints message in a loop, but I've
tried changing main.clj to modify both the print-hello function and
value of message, and it worked great. You can also connect to the
repl and do something like the following, but it doesn't provide the
same safety as the seemingly atomic require function does.

clojure.core=> (ns main)
nil
main=> (def message "hola")
#'main/message

-Travis

On Sep 4, 4:22 am, Krukow <karl.kru...@gmail.com> wrote:
> I was thinking about the capability of changing production systems on
> the fly. E.g. by having an accessible repl in a running production
> system.
>
> If you have a bug in a function, you can fix it by re-def'ing it -
> that is great. However, suppose you want to do a system upgrade where
> you want to change several things. Now you could just re-def each var
> one at a time, but this might produce an inconsistent program in the
> interval where you have re-def'ed some but not all vars.
>
> This first thing you would want is sort-of a atomic update of all
> vars, similarly to what is possible with refs. Is this possible
> somehow? If not are there any techniques or best practices for these
> "system upgrades"?
>
> /Karl
--~--~---------~--~----~------------~-------~--~----~
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to