why does (clojure.repl/source in-ns) not work while (doc in-ns) gives the documentation? I even tried to change my开发者_开发百科 namespace into clojure.core but did not help ... Can somebody tell me why this is happening..?
Interestingly, there is no source link for in-ns function in online documentation and I couldn't find this function in core.clj on github either.
It seems that this particular function was hardcoded in Java beneath clojure implementation.
See this link: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java
and this piece of code is your in-ns
:
final static IFn inNamespace = new AFn(){
public Object invoke(Object arg1) throws Exception{
Symbol nsname = (Symbol) arg1;
Namespace ns = Namespace.findOrCreate(nsname);
CURRENT_NS.set(ns);
return ns;
}
};
精彩评论