I have this function which takes all of the publics from one ns and
exports them in the current ns. My question is, is this the best way
to do it? Is there another method which doesnt use eval? I know eval
is supposed to be  'evil ' :)

(defn ns-export [from-ns]
  (map (fn [[sym var]]
         (let [v (if (.hasRoot var)
                   (var-get var))
               var-obj (if v (intern *ns* sym v))]
           (when var-obj
             (alter-meta! var-obj
                          (fn [old] (merge (meta var) old)))
             var-obj)))
       (ns-publics from-ns))
  true)

(defmacro eval-when [& args]
  (eval `(do ~@args)) nil)

(eval-when
 (require 'clojure.contrib.error-kit)
 (ns-export (find-ns 'clojure.contrib.error-kit)))

-- 
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