On Jan 27, 2011, at 10:41 PM, Ben Mabey wrote:

> On 1/27/11 7:24 PM, Ken Wesson wrote:
>> On Thu, Jan 27, 2011 at 6:24 PM, Mark Engelberg
>> <mark.engelb...@gmail.com>  wrote:
>>> Records don't have serialization yet, do they?
>> user=>  (defrecord Foo [n])
>> user.Foo
>> user=>  ((supers Foo) java.io.Serializable)
>> java.io.Serializable
>> 
>> Looks like they do.
> 
> I've been serializing/serializing records in my current project quite a bit.  
> The one caveat is that for java to serialize the record a class file needs to 
> be compiled for the record.  In my case that just meant I had to introduce 
> AOT via leiningen (which does complicate things TBH).
> 
> While this serialization has been fine for most of my needs I have quite 
> often wanted to be able to use *print-dup* since binary serialization seemed 
> overkill in those cases.  Hopefully something like defrecord2 gets added to 
> clojure at some point to make dealing with records more pleasant.

I don't think it's obvious whether any particular serialization mechanism is 
generally better or worse than another without knowing details about a 
particular context.  *print-dup*'s (and others') generally human-readable 
representations and dynamic nature are definitely nice and helpful in some 
cases; binary serialization mechanisms – including java.io.Serialization – that 
are generally static will usually be a few orders of magnitude faster.

The above is FWIW.  I just wanted to offer something tangible in response to 
"overkill". :-)

- Chas

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