I'm not sure if this would meet your need (it doesn't help with your proximate defrecord issue), but if you're primarily interested in documentation and validation you could consider prismatic/schema [1] as a translation target, and just represent your data with maps.
[1] https://github.com/Prismatic/schema On Wednesday, September 25, 2013 10:47:35 PM UTC-7, 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.