[plt-scheme] "define-values: cannot change identifier" when using "deserialize"

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Oct 16 08:27:15 EDT 2007

At Tue, 16 Oct 2007 05:15:36 -0700, Eric Hanchrow wrote:
> >>>>> "Matthew" == Matthew Flatt <mflatt at cs.utah.edu> writes:
> 
>     >> Thanks for doing the research, but I'm afraid I understand
>     >> neither dynamic-require nor deserialize enough to guess the
>     >> workaround.  Could you spell it out?
> 
>     Matthew> One approach is to delay the `deserialize' call until the
>     Matthew> "bot.ss" module body has been evaluated.  
> 
> As far as I can tell, it is already so delayed.

If I put

  (fprintf (current-error-port) "bot.ss\n")

at the top of "bot.ss", and

   (fprintf (current-error-port) "deserialize\n")

before the call to `deserialize' in "session.ss", then I see
"deserialize" printed before "bot".

>     Matthew> Alternately, put the `define-serializable-struct' into a
>     Matthew> module that can be `require'd by "session.ss", so that
>     Matthew> the struct definition is definitely ready by the time
>     Matthew> `deserialize' is called.
> 
> I actually tried that originally; it led to a confusing error.  To see
> it, apply the attached patch to r66, and run ./dry-test.sh again; I see
> 
>     sighting.ss:4:0: module: identifier already provided at: deserialize-
> info:sighting-v0 in: (provide (all-defined))
> 
> I don't understand that error, either; nor can I find a way around it.

`deserialize-info:sighting-v0' is both defined and provided by
`define-serializable-struct'. At the moment, `(all-defined)' doesn't
play right with `define-serializable-struct'; this is one of several
problems with `(all-defined)'.

Using `(provide (struct sighting (who where when was-action? words)))'
works for me.

Matthew



Posted on the users mailing list.