Re: [ANN] clojure.java.jdbc 0.7.0 Beta 2

63 views
Skip to first unread message

Phillip Lord

unread,
Jul 22, 2017, 6:08:43 AM7/22/17
to clo...@googlegroups.com

I am confused about how to exclude clojure.core from a namespace already
exists. That is, I have not just created the namespace, but it's been
given to me by a tool.

Consider, for example:




lein repl
nREPL server started on port 41054 on host 127.0.0.1 - nrepl://127.0.0.1:41054
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
OpenJDK 64-Bit Server VM 1.8.0_131-8u131-b11-0ubuntu1.16.04.2-b11

user=> (refer-clojure :only [])
nil
user=> (defn some[])
WARNING: some already refers to: #'clojure.core/some in namespace: user, being replaced by: #'user/some
#'user/some
user=>


Now, why do I get this warning? Surely some is not being replaced at
all, since the refer-clojure form should have removed some
clojure.core/some from the current namespace.

Phil

Phillip Lord

unread,
Jul 22, 2017, 8:04:54 AM7/22/17
to clo...@googlegroups.com

Apologies, didn't mean to follow that thread!
--
Phillip Lord, Phone: +44 (0) 191 208 7827
Biology, Medicine, Computing Email: philli...@newcastle.ac.uk
School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord
Room 914 Claremont Tower, skype: russet_apples
Newcastle University, twitter: phillord
NE1 7RU

Justin Smith

unread,
Jul 22, 2017, 8:08:03 AM7/22/17
to clo...@googlegroups.com
refer-clojure doesn't ever remove mappings, it only adds them

The reason a refer-clojure clause in your ns form can prevent bindings is because your refer-clojure clause (which is likely more qualified than the default) overrides the args that ns would otherwise provide to refer-clojure.



--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Phillip Lord

unread,
Jul 23, 2017, 3:21:59 AM7/23/17
to Justin Smith, clo...@googlegroups.com

Yep, appears that you are right. I ended with this:

(doseq
[[k v] (ns-map ns)
:when (= (find-ns 'clojure.core) (:ns (meta v)))]
(ns-unmap ns k))

which is pretty ugly.
Reply all
Reply to author
Forward
0 new messages