|
From: | Noah Lavine |
Subject: | Re: redo-safe-variables and redo-safe-parameters |
Date: | Wed, 27 Mar 2013 10:29:00 -0400 |
On Wed, Mar 27, 2013 at 1:42 PM, Noah Lavine <address@hidden> wrote:No that would be hard to reason about. set~ and (~ a) indicate that
> Hello,
>
> Let me see if I understand the point of set! and set~. I think the goal is
> to have a variable that is redo-safe, except that if someone uses set~ on
> it, then it is not redo-safe. Is that right?
you want to use it as a redo safe variable. set! and normal variable
reference and you will get normal behavior in user code.
> If you want to make a redo-safe variable act like it's not redo-safe, youYeah that could be one thing to describe it, but I think that it's
> can use an explicit box. You do it like this:
>
> (redo-safe-variable ((a 1)) (set~ a (make-variable)) ...)
>
> Inside the ..., you don't set~ or set! a, you use variable-set!. That way,
> if you capture the dynamic state and restore it, it just resets to being the
> same box as it was before, which means that all of the dynamic states share
> the same variable object and the same value. I think this is what Guile
> would do for regular variables anyway - you just have to be explicit about
> it here.
much nicer to let the code behave as scheme when the user code it as
scheme as described above.
[Prev in Thread] | Current Thread | [Next in Thread] |