[gambit-list] serialization of promises

Marc Feeley feeley at iro.umontreal.ca
Thu Jun 11 10:40:00 EDT 2009


On 11-Jun-09, at 12:23 AM, Darren Baker wrote:

> Marc -
>
> Gambit doesn't allow automatic serialization of promises (delay/force)
> using object->u8vector, is this by design or otherwise?
>
> It seems I could get around this by rolling my own force and delay,  
> but
> perhaps there's a good reason not to be trying to serialize such  
> things?
>

This is an oversight on my part.  With the current implementation of  
delay, there is no issue with serializing promises (apart from the  
fact that they have state, but that's no different than serializing a  
pair which also has state, i.e. force vs. set-car!/cdr!).

So I have implemented promise serialization/deserialization.   
Unfortunately I can't push the patch to the repository because our  
server has crashed (it should be back up in a few hours).

There are some general issues with serializing promises:

1) Gambit can be built to implement "autoforcing" on primitives, i.e.  
(+ (delay 1) (delay 2)) => 3 .  So the question is whether object- 
 >u8vector should autoforce or not.

2) Promises and "placeholders" (the result of a "future") are  
conceptually very similar and in previous versions of Gambit these  
were the same type.  But placeholders need a thread queue to suspend  
waiting threads, and these thread queues are not serializable.

> As an aside, I also noticed that there's a ##promise? predicate but no
> non-## version.  Seemed a bit odd.

I'll add that too.

Marc



More information about the Gambit-list mailing list