14

我的命名空间声明如下所示:

(ns test.foo
  (:use 
    [clj-http.client :only (get) :as client]
    [net.cgrand.enlive-html :only (select) :as html]))

它在 REPL 中运行良好,这是我第一次使用它。然后,当我修改代码并在 REPL 中尝试以下操作时:

(use :reload 'test.foo)

我得到:

java.lang.IllegalStateException: get already refers to: #'clj-http.client/get in namespace: test.foo (foo.clj:1)

我在逆时针方向的窗户上,也尝试过 leiningen (lein repl)。

4

1 回答 1

9

您不应该意外地影响核心 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]))
于 2011-01-10T16:40:40.263 回答