First , very thanks for you reply and very detailed explaining about
"refer".
in fact refer-clojure is variant of (refer 'clojure.core). what
clojureql does is refer clojure exclude distinct, conj and etc, and
redefine a itself version of distinct in which refer clojure/distinct.
you can read it's source code at github.com.  what make me puzzled is
clojureql.core will not include the var of distinct with (refer-
clojure :include [distinct]), then clojureql.core can def its own
distinct with any conflict. This is also the original idea of refer-
clojure with :exclude.
Okey, clojureql.core does very well in how to use "refer" and no any
issues. Why some warning of conflit be reported in the cmd of win when
the lein run myoa/core.clj? and when I refresh the browser the system
will failed with lots of error messsage?

Sincerely
Limux

On 4月11日, 上午6时37分, Meikel Brandmeyer <m...@kotka.de> wrote:
> Hi,
>
> Am 10.04.2011 um 14:37 schrieb limux:
>
> > java.lang.IllegalStateException: distinct already refers to:
> > #'clojureql.core/distinct in namespace: myoa.core (core.clj:1). but in
> > clojureql/core.clj has already (:refer-clojure
> >   :exclude [take drop sort distinct conj! disj! compile case]).
>
> What clojureql does is only of importance to clojureql. What happens is that 
> your namespace (myoa.core) "use"s clojureql and then tries to define an own 
> Var named distinct. This leads to the problem. To fix this you have to 
> exclude the clojureql distinct from the use clause. (ns myoa.core (:use 
> [clojureql.core :exclude (distinct)]))
>
> Here for illustration of what happens. The refers can be read as use clauses 
> in the ns definition. (I just used refer, because I don't have the 
> corresponding files. use is basically refer + loading from the file.)
>
> user=> (ns foo.bar)
> nil
> foo.bar=> (def x 5)
> #'foo.bar/x
> foo.bar=> (ns yoyo.dyne)
> nil
> yoyo.dyne=> (refer 'foo.bar)
> nil
> yoyo.dyne=> (def x 6)
> java.lang.IllegalStateException: x already refers to: #'foo.bar/x in 
> namespace: yoyo.dyne (NO_SOURCE_FILE:5)
> yoyo.dyne=> (ns frob.nicate)
> nil
> frob.nicate=> (refer 'foo.bar :exclude '(x))      
> nil
> frob.nicate=> (def x 7)
> #'frob.nicate/x
>
> Hope this helps.
>
> Sincerely
> Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to