File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Clojure and the fly likes dynamic update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » Clojure
Bookmark "dynamic update" Watch "dynamic update" New topic
Author

dynamic update

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

From chp1

Almost everything defined in a Clojure program can be re-defined, even while the
program is running: functions, multimethods, type hierarchies, even Java method
implementations as provided via proxy and gen-class.


Can someone help me understand the internal working ? Is it same as class reloading ?


Groovy
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

While I'm not sure and of course waiting for the authors to confirm but I think basically they are talking about Macros in Clojure and the Meta-programming capabilities.
Chris Houser
author
Greenhorn

Joined: Feb 07, 2011
Posts: 22

The exact mechanism used varies based on the kind of thing being reloaded.

Records and protocols (deftype, defrecord, and defprotocol) indeed do something like class reloading using a custom classloader provided by Clojure itself.

Most of the rest are built on top of Clojure Vars, which are a concurrency construct that allows for thread-safe mutation. Updating one of these amounts to making its Var point to the new definition.
 
wood burning stoves
 
subject: dynamic update