Date lör 20 oktober 2018

I just addded a prolog construct to assign action on unwind and rewind. When you backtrack you undo all changes to a point and when you restore a state you issues rewind actions. In this undo and redo chain you can issue actions. The problem is that this will be in the middle of a unwind or a rewind and the state is not synchronized. This is a problem. Previosly this is used in fallbacks to protect changes to datastructures and also enable redoing a state at a certain point. This is in C code and call back into scheme so it is a bit slow. So it is limited in what it can do. The task now with dynwind is to enable prolog code to be executed to inform and protect datastructures within polog itself. To note is that we have a good framework do protect datastructures allready and this should be used primarly, so the use of dynwind should be information only. Anyway in the name of letting the user drown with choices I present

dynwind(OnUnwindGoal),
dynwind(OnRewindGoal,OnUnwindGoal),

The inner workings of this will at the rewind point or unwind point call the submitted goal and execute with the variable bindings at the point of entering the dynwind. There is a restriction however, you shouled not mix objects used to be protected by guile-log's outomatic framework, that will not work currently because we will not synchronize the state of thos to these timepoints. This is a deficciency but you compining a pure prolog program with dynwind should be safe.

so now you will have,

> freeze(X, dynwind((write(unwind),nl))),X=1.

X = 1.
unwind

>

Comments

comments powered by Disqus

~ Follow me ~