Hi all,

I've a rather strange problem...I know that all clojure collections implement Serializable but when I try to use standard Java serialization on a vector of records I get this exception:

/NotSerializableException clojure.core.Vec java.io.ObjectOutputStream.writeObject0 (ObjectOutputStream.java:1180)/

observe this:

Clondie24.games.chess=> (ut/serialize! @current-chessItems "DELETE")
*
**NotSerializableException clojure.core.Vec java.io.ObjectOutputStream.writeObject0 (ObjectOutputStream.java:1180)*
Clondie24.games.chess=> (class @current-chessItems)
clojure.lang.PersistentVector
Clondie24.games.chess=> (ut/serialize! [:A :B :C :D] "DELETE") *;;SUCCESS*
nil
Clondie24.games.chess=> (first @current-chessItems)
#Clondie24.games.chess.ChessPiece{:image #<chess$starting_chessItems$fn__12387$fn__12388 Clondie24.games.chess$starting_chessItems$fn__12387$fn__12388@2a6446c9>, :position [0 0], :rank rook, :value 5, :direction 1}
Clondie24.games.chess=> (ut/serialize! *1 "DELETE2")

NotSerializableException clojure.core.Vec java.io.ObjectOutputStream.writeObject0 (ObjectOutputStream.java:1180) Clondie24.games.chess=> (ut/serialize! (dissoc *1 :image) "DELETE3") ;;MAYBE THE FUNCTION IS TO BLAME

NotSerializableException clojure.core.Vec java.io.ObjectOutputStream.writeObject0 (ObjectOutputStream.java:1180)
Clondie24.games.chess=> *1
#Clondie24.games.chess.ChessPiece{:image #<chess$starting_chessItems$fn__12387$fn__12388 Clondie24.games.chess$starting_chessItems$fn__12387$fn__12388@2a6446c9>, :position [0 0], :rank rook, :value 5, :direction 1} Clondie24.games.chess=> (ut/serialize! (dissoc *1 :position) "DELETE3") *;;SUCCESS*
nil
Clondie24.games.chess=> (class (get *2 :position))
clojure.core.Vec


it seems to me that the [:position [0 0]] slot in the record is causing the problems because it is a Vec and not a Vector...but then this is my defrecord definition:

(defrecord ChessPiece [ image ;;not really an image but a fn that fetches the image
                       ^clojure.lang.PersistentVector position
                        rank ^long value direction]
 core/Piece
 ...
 ...   )

any ideas? should I not have type hinted the record?

thanks in advance for your time :)

Jim




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

Reply via email to