Jim, This is indeed a hack and not a best practice, maybe you're not using the right tool for your problem...
- If you want to exchange data (think values), you should not be in need of keeping types and meta data when you exchange data in json, for example, you're not providing object class in the stream - If you just want serialization to reload hot data or use some kind of RPC mechanism over the wire, than I think edn is not the right tool. Cheers Le jeudi 22 août 2013 13:24:33 UTC+2, Jim foo.bar a écrit : > > Hi Meikel, > > this is funny! I thought about this approach but I originally considered > it to be a clever hack rather than the official way to do this...Since I > can't test it yet with my record , I hope you don't mind me asking another > question... > > there is no need for print-dup bound to true here, right? > > thanks a lot for your time :) > > Jim > > > On 22/08/13 12:00, Meikel Brandmeyer (kotarak) wrote: > > (defmethod print-method Foo > [foo ^Writer w] > (.write w "#my/foo ") > (print-method {:a (:a foo) :b (:b foo) :c (:c foo) :meta (meta foo)} w)) > > (defn foo-reader > [foo-data] > (with-meta (map->Foo (dissoc foo-data :meta)) (:meta foo-data))) > > Read with: > > (edn/read {'my/foo foo-reader} ...) > > Printing might be optimised a bit. And the :meta key could be made more > robust. (records may contain arbitrary keys.) > > > -- -- 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.