When I first started my project I tried using defrecord and defprotocol for 
various data structurs and when I wanted an easy serialization function I 
used pr-str and read-string, this worked great!... until I wanted to do 
some refactoring and move some types to another namespace.  After changing 
the namespace name, I could no longer read the serialized data structures 
since the serialized data included namespace and record type 
#namespace.Record{:prop value  .... }.  Ideally, I would just be able to 
redefine the reader literal for #namespace.Record so that I could define a 
custom function or perhaps alias it to an equivalent record type in a 
different namespace via *data-readers*, but this didn't seem to work for 
me.  It appears that data-readers can't override the reader literals for 
record types and instead read-string throws a class not found exception.  I 
have since stopped using record types for serialization and saving 
everything as maps, but this has increased the complexity of the 
deserialization logic as I need to store the type information in fields and 
restore these types after deserialization.  I liked using record types, but 
I don't like not being able to rename these types later if I change my 
mind.  

It seems to me that I should perhaps be able to override the reader 
literals for record types? 

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