@Mark
To be honest i cannot answer your question...however it works...demo follows:

sorted@sorted-desktop:~$ lein2 repl
nREPL server started on port 50832
REPL-y 0.1.0-beta10
Clojure 1.4.0
    Exit: Control+D or (exit) or (quit)
Commands: (user/help)
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
          (user/sourcery function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org: [clojuredocs or cdoc]
          (user/clojuredocs name-here)
          (user/clojuredocs "ns-here" "name-here")
user=> (defn record-factory [recordname]
  #_=>   (let [recordclass ^Class (resolve (symbol recordname))
#_=> max-arg-count (apply max (map #(count (.getParameterTypes ^java.lang.reflect.Constructor %)) #_=> (.getConstructors recordclass))) #_=> args (map #(symbol (str "x" %)) (range (- max-arg-count 2)))]
  #_=>     (eval `(fn [~@args] (new ~(symbol recordname) ~@args)))))
#'user/record-factory
user=> (ns foo)
nil
foo=> (defrecord Bar [x y])
foo.Bar
foo=> (ns user)  ;;back to user ns (doesn't depend on foo)
nil
user=> ((record-factory "foo.Bar") 1 2)
#foo.Bar{:x 1, :y 2}
user=> (Bar. 1 2)
CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: Bar, compiling:(NO_SOURCE_PATH:1)


Jim


On 12/12/12 17:59, Mark Engelberg wrote:
On Wed, Dec 12, 2012 at 9:53 AM, Jim - FooBar(); <jimpil1...@gmail.com <mailto:jimpil1...@gmail.com>> wrote:

    Yes it would...You're using reflection so no need to :use or
    :require the namespaces any more.
    Point your browser here if you're not following:
    https://github.com/jimpil/Clondie24/blob/master/src/Clondie24/lib/util.clj


What gets those classes loaded/imported to begin with? I don't see how the classes ever get built if nobody requires the file containing the defrecords.
--
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 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