[racket] serializing/deserializing structs (and read/writing them over ports)

From: Dominick LoBraico (dj+racket at lobraico.com)
Date: Fri Oct 5 00:04:50 EDT 2012


I have defined a struct in some file (create.rkt) like this:

(provide create make-create)
(define-serializable-struct create (name key assigned-date due-date))

In client.rkt, given name, key, assigned-date, and due-date as well as an
out-port called out, I do:

(require "create.rkt")
(define some_var (make-create name key assigned-date due-date))
(write (serialize some_var) out)

In another file, server.rkt and with the in-port analogous to out, I do

(require "create.rkt")
(define request (deserialize (read in))

However, when my program gets to this point, it fails with the following

dynamic-require: unknown module: '#%embedded:g1612:create

 === context ===

I am having trouble even beginning to debug this because it's not entirely
clear to me why dynamic-require wouldn't be able to find the create module
here and the error message is slightly cryptic to me. Any pointers or
guidance would be greatly appreciated!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121004/881913c7/attachment-0001.html>

Posted on the users mailing list.