On Wed, Jul 7, 2010 at 4:27 AM, Meikel Brandmeyer <m...@kotka.de> wrote: > Hi, > > On Jul 7, 3:37 am, Pedro Teixeira <pedr...@gmail.com> wrote: > >> user> (use 'clojure.test) >> user> (testing (defrecord R []) (new R) ) >> >> [exception: Unable to resolve classname: R] > > I think you get caught by the toplevel form. Clojure compiles the > complete testing form before executing it. So the (R.) can't see the > imported class, because the import is not executed, yet. However, > since (user.R.) is fully qualified no resolution has to be done and > things can be compiled. The moment the constructor is actually called, > the class is already generated. > > Executing the two forms at the toplevel first compiles and executes > the defrecord form - including the import. Then the (R.) form is > compiled and since the import was done the classname can be resolved. > > Hope that helps.
Thanks a lot for the insight. Are there any design guidelines for choosing between defrecords and defstruct, when one wants a map with type? I started with defrecord, but feels like I should switch to defstruct to avoid these complex host integration issues. best regards, Pedro -- 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