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

I think it's by design that privacy is enforced during symbol resolution but 
not during var lookup, var deref, or var invoke. It would be (somewhat) 
complicated and slow for any of the latter 3 to allow using the var from within 
its home namespace but not from within another namespace.

However, I'm not aware of this behavior being explicitly documented so if the 
code relying on it must be future-proof, I recommend checking with Rich.

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to