Serializable Collections ?

2 views
Skip to first unread message

Jules

unread,
Apr 27, 2010, 9:10:26 AM4/27/10
to Clojure
Guys,

I've searched the group and cannot find an answer to this one...

Why are many of the more common collection types in Clojure not
Serializable :

Clojure 1.1.0-new-SNAPSHOT
user=> (def #^java.io.ObjectOutput os (java.io.ObjectOutputStream.
(java.io.FileOutputStream. "/dev/null")))
#'user/os
user=> (.writeObject os [1 2 3 4])
java.io.NotSerializableException: clojure.lang.PersistentVector$Node
(NO_SOURCE_FILE:0)
user=> (.writeObject os (list 1 2 3 4))
java.io.NotSerializableException: clojure.lang.PersistentList
(NO_SOURCE_FILE:0)
user=> (.writeObject os #{1 2 3 4})
java.io.NotSerializableException: clojure.lang.PersistentHashMap
$BitmapIndexedNode (NO_SOURCE_FILE:0)
user=> (.writeObject os {:1 2 :3 4})
nil
user=>

I am writing a distributed Java/Clojure app and am constantly bitten
by this. I am always having to copy collections into ArrayLists before
sending them, from Java code, over the wire...

ArrayLists, however do not implement Comparable and I now need a
Comparable AND Serializable collection. :-(

Is there a wishlist for Clojure 1.2 ? :-)

Is there a good reason why making '(), [], {} and #{} Serializable
should not be on it ?

thanks


Jules

P.S.

I'm using 1.1.0-new-SNAPSHOT - is there another version that
implements this, hence the lack of noise on the list ?

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Brian Hurt

unread,
Apr 27, 2010, 10:59:04 AM4/27/10
to clo...@googlegroups.com
On Tue, Apr 27, 2010 at 9:10 AM, Jules <jules....@gmail.com> wrote:
Guys,

I've searched the group and cannot find an answer to this one...

Why are many of the more common collection types in Clojure not
Serializable :

I have an assemblia ticket open on this issue:
https://www.assembla.com/spaces/clojure/tickets/281-make-more-datastructures-serializable

I need to finish a new version of the patch that more carefully controls what is serialized.

Brian

Jules

unread,
Apr 28, 2010, 12:28:51 PM4/28/10
to Clojure
Brian,

Thanks for getting back to me :-)

I look forward to your changes making it into the mainline.

I'm going to register with Assembla and watch this ticket. If I find a
way to vote for it, I will do.

Jules


On Apr 27, 3:59 pm, Brian Hurt <bhur...@gmail.com> wrote:
> On Tue, Apr 27, 2010 at 9:10 AM, Jules <jules.gosn...@gmail.com> wrote:
> > Guys,
>
> > I've searched the group and cannot find an answer to this one...
>
> > Why are many of the more common collection types in Clojure not
> > Serializable :
>
> I have an assemblia ticket open on this issue:https://www.assembla.com/spaces/clojure/tickets/281-make-more-datastr...
Reply all
Reply to author
Forward
0 new messages