Hi,

Am 18.08.2009 um 21:40 schrieb Constantine Vetoshev:

(binding* [*x* 3]
 (start-jetty :port 8001 :my-servlet servlet-implemented-in-clojure))

There are two Assembla tickets, which go into that direction:
http://www.assembla.com/spaces/clojure/tickets/169-thread-local-bindings-interface
http://www.assembla.com/spaces/clojure/tickets/170-bound-fn-macro

I'm not familiar with jetty, so take with a grain of salt.

I could imagine that servlet-implemented-in-clojure is some function. Then (using the above patches) it could be made binding aware using the boundfn* function:

        (binding [*x* 3]
(start-jetty :port 8001 :my-servlet (boundfn* servlet- implemented-in-clojure)))

However, when ever you spawn a thread or when something running possibly delayed, you have to take similar actions. I'm not sure how easy it is do this automatically.

This issues are not yet included in Clojure officially. But the tickets suggests, that the issue is being addressed soon.

As for the re-def'ing: This is a non issue. Code which gets problems because of this, probably deserves it. The only legitimate use of a re- defing is during experimentation in the Repl. Production code should never ever have a def not at the toplevel. (The only exceptions are closing over a let-local for information hiding (which is no redefing) and macros expanding into a def (eg. defn, etc.))

Sincerely
Meikel

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to