Greetings,

Sorry for the delayed response.

On Feb 4, 2009, at 4:11 AM, David Wingate wrote:

...
When I attempt to serialize my structure, it gives the following
error:

(serialize foodata)
Unhandled exception
 Condition components:
   1. &assertion
   2. &who: fasl-write
   3. &message: "Cannot write a non-thunk procedure; the one given has
free vars"
   4. &irritants: (2)

I imagine this is NOT an error in Ikarus, but rather an error in my
thinking.

Could someone help me understand what generates this sort of error?


The fasl format in Ikarus is used primarily for serializing and deserializing Ikarus's own data structures (primarily, compiled library files). It has some limitations on what it can or cannot handle. Serializing closures, continuations, system stacks, ports, sockets, etc., are all problematic and never occur when serializing compiled libraries (unless you're doing "too clever" things with macros). You pretty much would be safe using it as long as procedures (and continuations, and guardians, and general hash tables, etc.) don't exist in the data structure you're trying to serialize.

Now, there is a limitation in the implementation that fasl-write allows writing procedures that have 0 lexical free variables (after optimization), but disallows writing procedures that have any lexical free variables. (I think it should disallow these in user code in order to avoid this confusion.) I recommend that you don't rely on this feature and only depend on serializing data structures that have known structures (e.g., pairs, vectors, strings, records, chars, numbers, booleans, (), etc.). This way, you'd keep your program more portable by not depending on implementation-specific features.

Aziz,,,

Reply via email to