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 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

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 > c

Re: peeking at private vars in unit tests

2009-12-14 Thread Rich Hickey
On Mon, Dec 14, 2009 at 1:16 AM, Chouser wrote: > On Sun, Dec 13, 2009 at 7:55 PM, Stephen C. Gilardi 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? >

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 bec

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 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: > >       �...@#'clojure.c

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 s

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 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 # user=> (@#'clojure.core/spread [:a :b [:c :d]]) (:a :b :c :d) user=> I

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 (if