【发布时间】:2015-09-11 08:02:39
【问题描述】:
我是一个 Clojure 新手,REPL 中的某些内容确实让我感到困惑。
我有一个名为“misc”的项目和一个位于“misc/src/counter_window.clj”的命名空间。当我确实从项目根文件夹输入 REPL 时,我想导入 counter_window 的函数,但我似乎每次都必须经历以下奇怪的探戈:
user=> (use 'counter-window)
FileNotFoundException Could not locate counter_window__init.class or counter_window.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name. clojure.lang.RT.load (RT.java:449)
user=> (use 'misc.counter-window)
CompilerException java.lang.Exception: namespace 'misc.counter-window' not found after loading '/misc/counter_window', compiling:(/tmp/form-init2530455467319465680.clj:1:1)
user=> (use 'counter-window)
nil ;; the import succeeds this third time.
FileNotFound 异常中的警告似乎不适用,因为命名空间在 counter_window.clj 文件中已被称为 counter-window。
那么为什么会这样呢?为什么第一次导入不成功,第三次导入成功?
【问题讨论】:
标签: clojure read-eval-print-loop