Hi! How should I approach serialization? I made a little test function which serializes and deserializes Clojure objects. It works for strings, integers, symbols, LazilyPersistentVectors and.. oddly.. PersistentHashMaps that have exactly one element. (My Clojure is about a month old.)
But for other things, like keywords and most PersistentHashMaps, it throws NotSerializableException. My imagined possible solutions: * Implement Serializable for Clojure data -- but is it possible in a dynamic "Hey I'll just write a new method!" way? * Go into Clojure's source and implement Serializable to the Java classes. My end goal is using a nonrelational DB like Tokyo Cabinet or BerkeleyDB. Thanks, Tayssir PS: Here's my test code: (defn my-identity "Copies obj through serialization and deserialization." [obj] (let [byte-out (new java.io.ByteArrayOutputStream) obj-out (new java.io.ObjectOutputStream byte-out)] (try (.writeObject obj-out obj) (finally (.close obj-out))) (let [obj-in (new java.io.ObjectInputStream (new java.io.ByteArrayInputStream (.toByteArray byte-out)))] (try (.readObject obj-in) (finally (.close obj-in)))))) --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---