Dam*_*ien 14 clojure read-eval-print-loop
我的命名空间声明如下所示:
(ns test.foo
(:use
[clj-http.client :only (get) :as client]
[net.cgrand.enlive-html :only (select) :as html]))
Run Code Online (Sandbox Code Playgroud)
它在REPL中工作正常,这是我第一次使用它.然后,当我修改代码并在REPL中尝试以下内容时:
(use :reload 'test.foo)
Run Code Online (Sandbox Code Playgroud)
我明白了:
java.lang.IllegalStateException: get already refers to: #'clj-http.client/get in namespace: test.foo (foo.clj:1)
Run Code Online (Sandbox Code Playgroud)
我在逆时针方向的窗户上,也尝试了leiningen(lein repl).
你不应该意外地影响核心fns.你必须明确你的意图:
(ns test.foo
(:refer-clojure :exclude [get]) ; suppress the shadowing warning
(:require [clojure.core :as core]) ; allow to still reach clojure.core/get through core/get
(:use
[clj-http.client :only (get) :as client]
[net.cgrand.enlive-html :only (select) :as html]))
Run Code Online (Sandbox Code Playgroud)