[racket] Units and serializable-struct

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Feb 5 02:35:18 EST 2015

The `struct` form in a signature describes a structure type that will
be implemented by some unit. It can't work to have a similar
`serializable-struct` form in a signature, because different units can
implement a signature with different structure types, and a
deserializer can't know which one to create.

Using `define-serializable-struct` in a `unit` form won't work, either.
That's because each instantiation of the unit create a different
structure type (assuming that the structure type is not prefab), which
leads to the same problem for the deserializer.

So, `define-serializable-struct` needs to be used outside of a
signature and outside of any unit. It could be in its own module, for

At Wed, 4 Feb 2015 16:19:23 -0500, Justin Zamora wrote:
> I am writing a program using units and got this message:
> define-signature: unknown signature form in: serializable-struct
> Sure enough, the docs show that serializable-struct is not allowed in a
> signature. Is this something that can be fixed or do I have to work around
> it (maybe by using regular structs and writing my own read-struct and
> write-struct routines)? What is the best course of action?
> Justin
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.