开发者

why does (clojure.repl/source in-ns) not work while (doc in-ns) gives the documentation?

开发者 https://www.devze.com 2023-01-25 22:24 出处:网络
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 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;
 }
};
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号