使用QuickStart设置Node REPL。
使用以下命令将{{foo/bar.cljs}}手动添加到文件系统中
`
(ns foo.bar)
(defn throw-ex [] (ffirst 1))
(defn call-me [] (throw-ex))
`
检查是否正常工作
`
cljs.user=> (require 'foo.bar)
nil
cljs.user=> (foo.bar/call-me)
repl:13
throw e4210auto__;
^
错误:1不是ISeqable
at Object.cljs$core$seq [as seq] (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:956:20)
at Object.cljs$core$first [as first] (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:965:16)
at cljs$core$ffirst (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:1398:11)
at foo$bar$throw_ex (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljs:3:20)
at foo$bar$call_me (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljs:5:19)
at repl:1:105
at repl:9:3
at repl:14:4
at Object.exports.runInThisContext (vm.js:74:17)
at Domain.<anonymous> ([stdin]:41:34)
`
然后手动将{{bar.cljs}}移动到{{bar.cljc}},并添加一个新的符号,使其看起来像
`
(ns foo.bar)
(defn throw-ex [] (ffirst 1))
(defn call-me [] (throw-ex))
(defn call-again [] (call-me))
`
然后重新加载命名空间并使用新的符号
`
cljs.user=> (require 'foo.bar :reload)
nil
cljs.user=> (foo.bar/call-again)
repl:13
throw e4210auto__;
^
错误:1不是ISeqable
at Object.cljs$core$seq [as seq] (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:956:20)
at Object.cljs$core$first [as first] (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:965:16)
at cljs$core$ffirst (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:1398:11)
at foo$bar$throw_ex (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljs:3:20)
at foo$bar$call_me (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljs:5:19)
at foo$bar$call_again (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljs:5:19)
at repl:1:108
at repl:9:3
at repl:14:4
at Object.exports.runInThisContext (vm.js:74:17)
`
这说明了缺陷。{{call_again}}和其他符号显示在旧的文件名中。
停止REPL并重新启动它以查看正确的行为
`
cljs.user=> :cljs/quit
orion:hello_world-node mfikes$ rlwrap java -cp cljs.jar:src clojure.main node_repl.clj
正在读取jar:file:/Users/mfikes/Desktop/hello_world-node/cljs.jar!/cljs/core.cljs的分析缓存
编译src/foo/bar.cljc
ClojureScript Node.js REPL服务器正在49397端口监听
编译日志可在out/watch.log中查看
要退出,请键入::cljs/quit
cljs.user=> (require 'foo.bar)
nil
cljs.user=> (foo.bar/call-again)
repl:13
throw e4210auto__;
^
错误:1不是ISeqable
at Object.cljs$core$seq [as seq] (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:956:20)
at Object.cljs$core$first [as first] (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:965:16)
at cljs$core$ffirst (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:1398:11)
at foo$bar$throw_ex (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljc:3:20)
at foo$bar$call_me (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljc:5:19)
at foo$bar$call_again (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljc:7:22)
at repl:1:108
at repl:9:3
at repl:14:4
at Object.exports.runInThisContext (vm.js:74:17)
`