[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: redo-safe-variables and redo-safe-parameters
From: |
Stefan Israelsson Tampe |
Subject: |
Re: redo-safe-variables and redo-safe-parameters |
Date: |
Wed, 27 Mar 2013 08:13:46 +0100 |
User-agent: |
KMail/4.9.5 (Linux/3.5.0-26-generic; KDE/4.9.5; x86_64; ; ) |
On Tuesday, March 26, 2013 06:36:46 PM Noah Lavine wrote:
> Okay. I don't see a use for number 1. Could you explain why it's
> important? It seems easier to me to just let each variable have its
> own type.
Actually it has it's uses.
1.
Note. This ideom aims at being a sound extension to the case where we
have non boxed local variables that are never put into a closure and
where we mutate them with lexical-set directly. Maybe that is easier
to think of them this way. As you see this ideom will enable pretty
fast execution of the code in the common case where the variable is
never put in a closure. It will in the not uncommon case when you put
a local variable inside a closure and return it and preserve the redo
safe
property.
I didn't see that fluid-let could allow this as well through an
optimization e.g.
(let ((a 1)) code ...)
redo safe and can be well optimized =>
(let (a)
(fluid-let ((a 1)) code ...))
And it's actually better in many ways in that fluid-let guards the
outer context of the variable to be changed. On the other hand,
fluid-let does not mix well with delayed computations, my suggestion
does so indeed. So Different notions, different benefit. But as you
say thay are close to my number 2 suggestion
> As for 2, I believe that's how MIT Scheme's (fluid-let ...) works. I
> suspect that if you give up property 1, then fluid-let would do the
> job you want.
No, parameter values are stored in different dynamic state and because
you have one dynamic state per thread usually (it's possible to let
threads share dynamic-state) the concpet is safe with respect to
multithreading. It does not look like fluid-let have that property.
a)
> Also, in the example you gave earlier (in your third email in this
> thread, beginning with "you need to combine fluids and dynamic wind
> ..."), I don't see the difference between set! and set~ semantics.
b)
>It
> seems like the variables there have exactly the same semantics as
> fluids, except that you don't have to use (fluid-ref ...) to get
> their value.
a)
set! means that you will box a value. The coders intention is that it
should
behave as such. With set~ you will many times be able to unbox the
value. But as you say, with the example it may look like they are the
same. But note that putting a set! in the code means that the
variables becomes unguarded and the with-undo-variables becomes a
no-op. Really The whole setup is done in order to keep ~ semantic
enclosed in a macro and the user of the macro should can work as if
the macro only uses local variables with no set!.
b)
As I said, you are right that they are close in notion and many times
the semantic will overlap but as described above they are different.
/Stefan
- redo-safe-variables and redo-safe-parameters, Stefan Israelsson Tampe, 2013/03/26
- Re: redo-safe-variables and redo-safe-parameters, Noah Lavine, 2013/03/26
- Re: redo-safe-variables and redo-safe-parameters, Stefan Israelsson Tampe, 2013/03/26
- Re: redo-safe-variables and redo-safe-parameters, Noah Lavine, 2013/03/26
- Message not available
- Re: redo-safe-variables and redo-safe-parameters, Noah Lavine, 2013/03/26
- Re: redo-safe-variables and redo-safe-parameters, Stefan Israelsson Tampe, 2013/03/26
- Re: redo-safe-variables and redo-safe-parameters, Noah Lavine, 2013/03/26
- Re: redo-safe-variables and redo-safe-parameters,
Stefan Israelsson Tampe <=
- Re: redo-safe-variables and redo-safe-parameters, Noah Lavine, 2013/03/27
- Re: redo-safe-variables and redo-safe-parameters, Stefan Israelsson Tampe, 2013/03/27
- Re: redo-safe-variables and redo-safe-parameters, Noah Lavine, 2013/03/27
- Re: redo-safe-variables and redo-safe-parameters, Stefan Israelsson Tampe, 2013/03/27
- Re: redo-safe-variables and redo-safe-parameters, Noah Lavine, 2013/03/27
- Re: redo-safe-variables and redo-safe-parameters, Stefan Israelsson Tampe, 2013/03/27
- Re: redo-safe-variables and redo-safe-parameters, Noah Lavine, 2013/03/27
- Re: redo-safe-variables and redo-safe-parameters, Noah Lavine, 2013/03/27
- Re: redo-safe-variables and redo-safe-parameters, Stefan Israelsson Tampe, 2013/03/28
- Re: redo-safe-variables and redo-safe-parameters, Stefan Israelsson Tampe, 2013/03/27