I'm trying to actually change some instances of :use to :require :refer :all, 
as urged by several people here, and it's not as simple as I had hoped. Or I'm 
missing something obvious.

If I have a simple little project containing a namespace declared as follows:

(ns use2require.core
  (:use [use2require myfns yourfns]))

then I can indeed make it work with:

(ns use2require.core
  (:require [use2require.myfns :refer :all]
            [use2require.yourfns :refer :all]))

but that's quite a lot more verbose, not only because of the extra keywords but 
because I have to list the complete namespaces individually. In real projects I 
may have half a dozen or more namespaces in a single line, so that will really 
blow up.

I assume that there's a shortcut but what I've tried hasn't worked, and I don't 
see documentation or examples of this.

If I try:

(ns use2require.core
  (:require [use2require myfns yourfns :refer :all]))

under Eclipse/CCW with Clojure 1.5.1 I get:

;; Clojure 1.5.1
;; Switching to use2require.core namespace
IllegalArgumentException Don't know how to create ISeq from: 
clojure.lang.Keyword  clojure.lang.RT.seqFrom (RT.java:505)
#<Namespace use2require.core>

If I try: 

(ns use2require.core
  (:require [use2require myfns yourfns] :refer :all))

then I get:

;; Clojure 1.5.1
;; Switching to use2require.core namespace
Exception Unsupported option(s) supplied: :all  clojure.core/load-libs 
(core.clj:5408)
#<Namespace use2require.core>

I did figure out that something *slightly* better than the 
full-namespace-per-line version above that actually works:

(ns use2require.core
  (:require [use2require [myfns :refer :all]
                         [yourfns :refer :all]]))

But it's really not much better. This too will explode the number of lines in 
many of my ns declarations.

Is there indeed a reasonably concise way to do this? What is it?

Thanks, 

 -Lee

PS: For most of my purposes the ideal ns declaration for the example above 
would be just (ns use2require.core) -- with an implicit "find everything 
wherever you can, looking in the project directory and anywhere else 
reasonable, and hassle me about it only if you can't find something or if 
there's a conflict that I have to resolve."  I know that many of you will have 
valid reasons for not wanting this in the contexts within which you work, and I 
know that it's unlikely that anything in Clojure will change to accommodate my 
perspective here, but I sure would like it if I could do something so simple. 
And I'd certainly not like this stuff to get more cumbersome than it already is.

-- 
-- 
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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to