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?
As an aside, I also noticed that there's a ##promise? predicate but no non-## version. Seemed a bit odd.
Cheers Darren
Afficher les réponses par date
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
Thanks Marc for your quick response and patch, much appreciated.
There are some general issues with serializing promises:
- 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.
FWIW I view object->u8vector as a non side-effecting snapshot tool, it's a bit disturbing that the act of looking would change its state. :-) (Even if such state is supposed to be transparent to the user.)
By the way, turning on the autoforce option would cause an explosion of unavoidable type checks I assume?
Thanks again, Darren