[racket] Units and serializable-struct
That makes sense. Thanks.
Justin
On Feb 5, 2015 2:35 AM, "Matthew Flatt" <mflatt at cs.utah.edu> wrote:
> 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
> example.
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20150205/8157f9a1/attachment.html>