[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] serialization of functions, closures, continuations
From: |
Michele Simionato |
Subject: |
Re: [Chicken-users] serialization of functions, closures, continuations |
Date: |
Wed, 18 May 2005 03:14:23 -0400 |
On 5/18/05, felix winkelmann <address@hidden> wrote:
> On 5/16/05, Michele Simionato <address@hidden> wrote:
> > Hi Felix, my subject says it all.
> >
> > In Chicken:
> >
> > 1. Can I serialize a function?
> > 2. Can I serialize a closure?
>
> No. A function/procedure/closure contains a pointer to compiled
> C code and is built at run-time. Serialization into a file and subsequent
> de-serialization would have to modify the code-pointer to the proper
> value. Depending on the loaded symbols and linked in libraries
> the locations of the code may vary wildly.
> One solution would be to compile a function-map into the code
> and use these to convert code-pointers into some unique identifier
> on serialization and do the reverse lookup on deserialization.
>
> Oh, if I just had more time...
So it seems possible but technically difficult.
Are there Scheme implementations that can serialize functions and closures?
> > 3. Can I serialize a continuation?
> >
>
> See above (a continuation is just a special closure). One remark:
> continuation serialization, even thoughj it is currently quite
> fashionable, is IMHO somewhat questionable: estimating the size of a
> continuation
> is hard, even for someone who knows the implementation well. In
> the worst case you drag in the whole global environment.
Yes, I was reading
http://www.double.co.nz/scheme/modal-web-server.html
which is interesting but stops at the point of serializing continuations,
making the approach unpractical, I cannot keep everything in memory!
BTW, do you know how people solve this? I think PLT has a modal
server in its library (not sure, I should check).
The modal web server seems to be the only usage of continuations
I cannot emulate with other means (i.e. if my language has already
generators and coroutines, why would I want continuations? there
would be a real advantage if I could serialize continuations, but it
seems difficult/unpractical).
Michele Simionato
P.S: BTW, I have added a recipe on the Chicken Wiki on how to implement
Python generators for the Pythonistas in this list ;)
- [Chicken-users] serialization of functions, closures, continuations, Michele Simionato, 2005/05/17
- Re: [Chicken-users] serialization of functions, closures, continuations, felix winkelmann, 2005/05/18
- Re: [Chicken-users] serialization of functions, closures, continuations,
Michele Simionato <=
- Re: [Chicken-users] serialization of functions, closures, continuations, felix winkelmann, 2005/05/18
- Re: [Chicken-users] serialization of functions, closures, continuations, F. Wittenberger, 2005/05/19