[closer-devel] slots on layers
Pascal Costanza
pc at p-cos.net
Sun Aug 24 11:58:14 UTC 2008
On 20 Aug 2008, at 15:09, Attila Lendvai wrote:
> a simpler but very similar example: think of a recursive graph
> traversal algorithm that can be customized using contextl and can stop
> and resume the traversal at various points. say it needs to traverse
> potentially infinite graphs in the background and at various nodes it
> needs the user's feedback to make decisions that affect the _rest_ of
> the traversal but only on the rest of _that_ path.
>
> so it needs to be able to stop and resume the traversal at multiple
> nodes at the same time. whenever its stops, it needs a way to capture
> the current dynamic context (including the layer instance and its
> slots), so that it can be restored when the user comes back and anwers
> the question that made the traversal on this path to halt.
OK, let me try to hook into this example, because it seems simpler
than the other descriptions. Maybe we can bootstrap a solution from
here.
What you describe seems to be a classic scenario for using first-class
continuations. What I already have on my todo list for ContextL is
support for first-class dynamic closures. The idea would be that you
can say something like (capture-dynamic-bindings), which gives you a
first-class representation of all special variables, which you can
later reinstate by something like (with-reinstated-dynamic-
bindings ...). Such a dynamic closure facility would capture the
current representation of active layers (because that's in a special
variable), as well as, for example, special slots both in the layers
and in other objects.
(It won't be as general as that, I will have to require registering
the special variables that you want to see captured, but I think I can
make this relatively non-intrusive.)
Would that solve your problem?
I already know how to implement this in a portable way, and it
shouldn't affect the essential performance of ContextL. I just need a
couple of days of free time to do this...
What's your opinion? Am I still off of what you need?
Pascal
--
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium
More information about the closer-devel
mailing list