On Jun 23, 12:29 pm, Stuart Halloway stuart.hallo...@gmail.com
wrote:
I think the behavior you are seeing here is reasonable. When you mix
compilation and dynamic access to vars, you need to reason carefully about
the order in which things will happen.
In general I would say that code
I think the behavior you are seeing here is reasonable. When you mix
compilation and dynamic access to vars, you need to reason carefully about the
order in which things will happen.
More usefully: you can write a test in your var-get expression that will make
it do what you want in all
(ns testcomp)
(var-get (or (ns-resolve *ns* 'foo)
(intern *ns* 'foo :foo)))
;; foo ;(1)
;; (println foo) ;(2)
;; (do foo 3);(3)
;; (fn [] foo) ;(4)
;; ((fn [] foo)) ;(5)
;; ((fn [] (println foo))) ;(6)