我是一個Clojure新手,在REPL中有些事情讓我很困惑。Clojure REPL忘記類路徑
我在「misc/src/counter_window.clj」有一個名爲「misc」的項目和一個名稱空間。當我進入該項目的根文件夾我想要導入counter_window的功能REPL,但我似乎必須通過以下怪異的探戈每次去:
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
。
那麼爲什麼會發生這種情況呢?爲什麼第一次導入不成功,但第三次成功?
我缺少命名空間中的'misc.'! – RGrun