Re: peeking at private vars in unit tests

2009-12-14 Thread Stuart Halloway
I see now that the simpler expression: #'clojure.core/spread equivalent to (var clojure.core/spread) also works: user= (#'clojure.core/spread [:a [:b :c]]) (:a :b :c) This works for refs but not for atoms. :-/ Stu -- You received this message because you are

Re: peeking at private vars in unit tests

2009-12-14 Thread Rich Hickey
On Mon, Dec 14, 2009 at 1:16 AM, Chouser chou...@gmail.com wrote: On Sun, Dec 13, 2009 at 7:55 PM, Stephen C. Gilardi squee...@mac.com wrote: On Dec 13, 2009, at 6:54 PM, Stuart Halloway wrote: That's great. I wouldn't have expected it to work. Do you think this is by design or

Re: peeking at private vars in unit tests

2009-12-14 Thread Meikel Brandmeyer
Hi, Am 14.12.2009 um 07:16 schrieb Chouser: I'd like a ruling on this as well. It solves a real problem of macros getting access to helper functions, so if we shouldn't be relying on it, a reliable solution would be desirable. This technique is actually used in the new branch in

Re: peeking at private vars in unit tests

2009-12-14 Thread Rich Hickey
On Mon, Dec 14, 2009 at 8:18 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: I see now that the simpler expression:       #'clojure.core/spread equivalent to       (var clojure.core/spread) also works:       user= (#'clojure.core/spread [:a [:b :c]])       (:a :b :c) This works

peeking at private vars in unit tests

2009-12-13 Thread Stuart Halloway
(1) Is there already a form that does this? or (2) If not, how can the following be better/simpler: (use 'clojure.contrib.with-ns) (defmacro wall-hack-var Return the value of a var in a namespace, even if it is private. Intended for test automation. [ns v] `(with-ns '~ns

Re: peeking at private vars in unit tests

2009-12-13 Thread Stephen C. Gilardi
On Dec 13, 2009, at 3:19 PM, Stuart Halloway wrote: (1) Is there already a form that does this? Hi Stuart, I think the trick is resolving manually: user= @#'clojure.core/spread #core$spread__4510 clojure.core$spread__4...@bb273cc user= (@#'clojure.core/spread [:a :b

Re: peeking at private vars in unit tests

2009-12-13 Thread Stuart Halloway
Steve, That's great. I wouldn't have expected it to work. Do you think this is by design or coincidental/subject to change? Stu On Dec 13, 2009, at 3:19 PM, Stuart Halloway wrote: (1) Is there already a form that does this? Hi Stuart, I think the trick is resolving manually:

Re: peeking at private vars in unit tests

2009-12-13 Thread Stephen C. Gilardi
On Dec 13, 2009, at 6:54 PM, Stuart Halloway wrote: That's great. I wouldn't have expected it to work. Do you think this is by design or coincidental/subject to change? The expression I gave was: @#'clojure.core/spread equivalent to: (deref (var clojure.core/spread)) I

Re: peeking at private vars in unit tests

2009-12-13 Thread Chouser
On Sun, Dec 13, 2009 at 7:55 PM, Stephen C. Gilardi squee...@mac.com wrote: On Dec 13, 2009, at 6:54 PM, Stuart Halloway wrote: That's great. I wouldn't have expected it to work. Do you think this is by design or coincidental/subject to change? The expression I gave was: