Closed charles-dyfis-net closed 10 years ago
I know this is a rather old issue, but I thought I'd shed some light on it. The behavior here is the result of the interaction between two things: 1) in Clojure 1.4 (and 1.5) there was a bug in the delay implementation where it did not cache the result of the body of the delay when an exception occurred, and 2) slingshot's environment capture feature is interacting with locals clearing.
Conclusion: this behavior is "fixed" in 1.6, it is mostly a bug in Clojure's delay, because it never should have executed the body of the delay more than once, but also slingshot's environment capture is contributing to the weirdness here (see https://github.com/scgilardi/slingshot/issues/36).
closing this along with issue #36
The following may boil down to a bug in Clojure upstream. However, I'm unable to reproduce it without the use of Slingshot, and don't understand the intricacies of Slingshot's internals well enough to generate a non-slingshot-dependent reproducer to be filed upstream. Hence:
If using
(throw (Exception. "Throwing per request"))
rather than(throw+ "Throwing per request")
, the second deref returns"Value"
.