I'm not sure about your actual questions, but you should note that `foo` is not actually a var which you can reference like `some-ns/foo`. Rather, it is a Class. Consider:
user=> (defrecord Thing [a b]) user.Thing user=> user=> (def OtherThing Thing) #'user/OtherThing user=> user=> (Thing. "hello" "sir") #user.Thing{:a "hello", :b "sir"} user=> user=> (OtherThing. "hello" "sir") CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: OtherThing, compiling:(/private/var/folders/rz/2h_qlr5d2m7dts2xpshlz_nr000c_x/T/form-init123235568201547659.clj:1:1) So you might be wise to put another layer of abstraction in there if you need to alias the class in addition to it's constructor functions. On Thursday, 26 September 2013 06:47:35 UTC+1, Vincent Chen wrote: > > Hi, > > I have in my hands an XML description of data structures that I want > to mechanically translate into Clojure. There are <struct> and > <typedef> elements, with <struct> being similar to structs in C (list > of fields) and <typedef> being similar to typedef in C (defining new > name for already defined <struct>s). > > I model <struct>s using Clojure records, but I'm not sure how to refer > to them with a new name when it comes to <typedef>s. Given the > following specification: > > <struct name="foo"> > <field name="a"/> > <field name="b"/> > </struct> > > <typedef oldname="foo" newname="bar"> > > I would create records: > > (defrecord foo [a b]) > (defrecord bar [a b]) > > The problem is that struct foo and typedef bar lives in different > namespaces, i.e. I don't have foo's specification when I encounter > typedef bar. What I'd like to do is (def bar some-ns/foo), but what > about ->foo and map->foo? > > So should I: > - (def bar some-ns/foo) (def ->bar some-ns/->foo) (def map->bar > some-ns/map->foo), while hoping that Clojure doesn't extend records > syntax/capabilities in the future? > - Use something else than records to model structs (suggestions welcome)? > - Other? > > Thanks, > > Vincent > -- -- 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.