On 1 April 2013 05:16, Stefan Israelsson Tampe <stefan.ita...@gmail.com> wrote: > Note two things > * it's better to pile up the redo-safe-variables with a parameter > then the clumsy version in the previous mail which will not work well. > > * A continuation that backtracks from down the stack back to the creation of > the > continuation needs to restore the variable in order for redo and undo to > be correct. This means that dynamic wind should be skiped for redo > safe variables. > > e.g. you need to guard the state booth upwards and downwards. The reason to > do this is that if we want to consider non-boxed variables that we > local-set as an > optimization for undo safe variables we need to add this complexity >
Dynamic states are not suitable for the purpose. They have nothing to do with compenstating for the inability of continuations to backtrack _through side-effects_. I believe this will be obvious if you consider the problem of side-effects generally, rather than focusing only on variable assignment. Backtracking is typically handled (at least, in part) by the evaluator, by either: - explicitly tracking side-effects, so that they can be reverted in a sensible manner; or - state-copying, that is, non-mutable environments. Of course, in the absence of side-effects backtracking can be trivially handled by continuations. It seems you hope to abuse dynamic states to avoid explicitly tracking the side-effects and the result is quite a mess. I do not see how you can hope to marry the concepts of continuations and backtracking side-effects without modifying the evaluator, at which point you have continuations and an evaluation environment that is not Scheme, although perhaps very Scheme-like. It seems your real objective is to extend Scheme-embedded logic DSLs by supporting continuations and non-functional Scheme code within them. I appreciate that you have some experience in the area, can you point to any papers that discuss anything similar to what you are trying to achieve? (Not the Scheme modifications, but the logic DSL + side-effects + continuations). Back to the Scheme modifications. Perhaps I do not understand that problem space as well as you, but when I look at this I see a premature attempt to solve a problem that is _hard_. There is also no precedent for continuations that backtrack side-effects in any Scheme or Lisp I know of, and noone will miss that if you do not acheive it. Clearly you are spending some effort on this, and I do not like to see anyone wasting efforts. IMO this specific path is unproductive. Regards