Details
-
Type:
Defect
-
Status:
Closed
-
Resolution: Completed
-
Affects Version/s: None
-
Fix Version/s: Release 1.2
-
Component/s: None
-
Labels:None
Description
Steve Gilardi and I noticed some strange behaviour with local clearing in conjunction with delay:
(defn do-something [x]
(throw (Exception.)))
(defn clear-locals [x]
(delay (try (do-something x)
(catch Exception e
(println "argument value:" x)))))
(force (clear-locals :argument))
;; => argument value: nil
It seems the locals are getting cleared a little too aggressively here. I did some digging to discover that delay is a thin wrapper around an fn, but using an fn in this context (rather than a delay) does not trigger the problem. Also I found that throwing an exception directly inside the try block (rather than in a function called from the try block) did not trigger it.
I was able to reproduce in the new branch, the master branch, and 1.0.0, so it's not related to the more recent locals-clearing changes.
Converted from http://www.assembla.com/spaces/clojure/tickets/232
Attachments:
locals.clj - https://www.assembla.com/spaces/clojure/documents/d6rA1a9ASr3RHaeJe5afGb/download/d6rA1a9ASr3RHaeJe5afGb