-
在org.clojure/tools.reader 中有 2 套 代码 一套 cljs 一套clojure 用在clojurescript中的时候会替换掉 代码中出现引用 clojure.xxx 的 cljs.xxx
在sci 项目中
image.png
如果用clojurescript来编译(cljurescript当前(2022年4月17日)还是在jvm上运行的,在运行过程中会加入 futures "cljs" )
上面的clojure.tools.reader.reader-types :as r 会变成
cljs.tools.reader.reader-types :as r

- CLJS-1692: Autoalias clojure.* to exisiting cljs.* namespaces if possible
(defn clj-ns->cljs-ns "Given a symbol that starts with clojure as the first segment return the same symbol with the first segment replaced with cljs" [sym] (let [segs (string/split (clojure.core/name sym) #"\.")] (if (= "clojure" (first segs)) (symbol (string/join "." (cons "cljs" (next segs)))) sym)))
(defn rewrite-cljs-aliases
"Alias non-existing clojure.* namespaces to existing cljs.* namespaces if
possible."
[args]
(map process-rewrite-form args))
网友评论