Closed weavejester closed 11 years ago
Actually, I've just realized this will break reader fallback for serialization and deserialization of records, so don't merge yet.
Some investigation reveals that, as per #24, Nippy is not currently able to serialize records anyway via the reader fallback. Raw types from deftype
are also unserializable by default unless one of the print multimethods is implemented, or unless a custom Nippy serialization is designed.
So unless I'm missing something, this shouldn't break any existing functionality... a second opinion would be very welcome, however.
Hi James, thanks a lot for this (and #24)!
Busy heading to bed now, but will definitely take a look at this tomorrow and get back to you ASAP.
Looks good to me. Going to merge to test the changes locally. One thing we might want to add is a :readers
option for passing to edn/read-string
since that doesn't seem to check the *data-readers*
binding.
Now that I look into it, that's very true. Should the option be called :readers
or the more specific :edn-readers
?
Okay just pushed to the master branch with all your changes and a couple of tweaks (notably the IPersistentCollection change).
Now that I look into it, that's very true. Should the option be called :readers or the more specific :edn-readers?
Another alternative: how would you feel if we just use *data-readers*
as the :readers arg for edn/read-string
? Not sure how often people are going to be wanting to adjust readers on an ad-hoc basis...
Seems reasonable, though to be honest it doesn't affect me much. If I have a custom tagged literal I want to serialize, I'd probably just write a custom freeze/thaw for it as well.
Fixes issue #15 (and probably #23 as well) by replacing the unsafe Clojure reader with the EDN reader from the Clojure tools.reader project.