[racket-dev] Modules with images can not be mashalled?!

From: Benjamin Seppke (seppke at informatik.uni-hamburg.de)
Date: Thu Nov 18 04:38:50 EST 2010


we use DrRacket for educational purpose at our University and have found 
out some "strange" behavior of the module system.

For one excercise, we provide a racket module containing (and providing) 
symbols that have images (of flags) as values. The students should use 
these images to visualize the results of their programs.

When the module file is put in the same directory  as the students' 
excercise file, Racket gives an error message after (require 
"flag-module.rkt") telling us:

write: cannot marshal constant that is embedded in compiled code: 
(object:image-snip% ...)

Okay, so marshalling is the problem here... However, it works if we add 
the file to the collects/XXX Folder and load it via (require 
xxx/flag-module) - maybe because collect modules are not compiled again?

It also works if I uncheck "fill compiled/-directories" in 
"Language->Select lang->Details". Although this works, I would prefer a 
successful loading of modules, which contain images, without disabling 
the compilation. As I'm not too familiar with Racket's internals, I'm 
asking if there is a way to achieve that. Or - maybe - if this behavior 
is by design, and Racket is supposed to work like that?

Btw, I am using Racket 5.0.1 @ Mac OS X 10.5, but this behavior seems to 
occur independently of the OS.

Best regards,
Benjamin Seppke

Posted on the dev mailing list.