Skip to content

Instantly share code, notes, and snippets.

@charles-dyfis-net
Created August 30, 2012 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charles-dyfis-net/9a1fa25f9a7429b6def7 to your computer and use it in GitHub Desktop.
Save charles-dyfis-net/9a1fa25f9a7429b6def7 to your computer and use it in GitHub Desktop.
(defn repro-bug [ref]
(let [my-delay (delay
(cond
(nil? ref) :nil
(= :throw @ref) (throw+ "Exception")
:else @ref))]
(fn [] @my-delay)))
(def repro-bug-atom (atom :throw))
(def repro-bug-inst (repro-bug repro-bug-atom))
(repro-bug-inst) ;; => throws "Exception" correctly
(reset! repro-bug-atom "Value")
(repro-bug-inst) ;; => returns :nil, not nil or "Value"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment