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

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

Here's the short version of the problem, as far as I can tell:

 (module a mzscheme
  (require "b.ss")
  (define const 10))

 (module b mzscheme
   (dynamic-require "a.ss" #f))

Instantiating "a.ss" starts by instantiating "b.ss". Instantiating
"b.ss", in turn, dynamically instantiates "a.ss" via `dynamic-require'.
When the "b.ss" is done evaluating, the continuation finishes
instantiating "a.ss" --- but "a.ss" was already instantiated.

In your program, the `dynamic-require' is hidden behind `deserialize'.

I'm not sure where the blame goes for this problem. Maybe "a.ss" should
be marked as "in progress" when it starts instantiating its imports,
just as "b.ss" is marked as "in progress" while its body is being
evaluated (which is why there's no recursive instantiation of "b.ss").
That change would give you a different error message, but wouldn't make
deserialization work.

Meanwhile, I hope the above at least suggests a workaround for your


Posted on the users mailing list.