guile-devel
[Top][All Lists]
Advanced

[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 17:15:22 +0100
User-agent: KMail/4.9.5 (Linux/3.5.0-26-generic; KDE/4.9.5; x86_64; ; )

On Wednesday, March 27, 2013 11:29:39 AM Noah Lavine wrote:
> On Wed, Mar 27, 2013 at 11:04 AM, Stefan Israelsson Tampe <
> 
> address@hidden> wrote:
> > Hi Noha,
> > 
> > On Wed, Mar 27, 2013 at 3:29 PM, Noah Lavine
> > <address@hidden>> 
> > wrote:
> > > Hello,
> > > 
> > > 
> > > On Wed, Mar 27, 2013 at 9:22 AM, Stefan Israelsson Tampe
> > 
> > > <address@hidden> wrote:
> > I don't understand the difference. If I use ~, I get redo-safe
> > behavior, and
> > 
> > > if I use !, I get regular behavior (value shared between dynamic
> > > states). Can I use ~ and ! on the same variable at different
> > > places in the code?> 
> > If
> > 
> > > yes, doesn't it have to switch behavior?
> > 
> > using set! means that you basically destroys the redo safe property.
> > There is no sound concept where you mix them. If you want to mix
> > them
> > use ~ and add correct function guards to describe the semantics.
> > ...
> 
> You want to allow a user to let one variable behave as with set! and
> one as
> > with
> > set~. It is not broken, the useres sees ~ on one of the varibles and
> > ! on the other.
> 
> Yes, I agree. What I'm saying is, there should be two different ways
> to declare the variables, and once a variable is declared, you should
> not need to look elsewhere in the code to see whether it acts like a
> regular or redo-safe variable. If that is what you specified, I
> apologize, but I thought that it wasn't.
Hmm, your really are right in the sense that the common ideom in
computer language design is to type a variable at the declaration of
the variable. So basically a user would then do something like 
(for ((~ i) from 0) code ...) to force the intruduction of a redo safe 
variable. Hmm yolly good. This might be the better semantic and not
trust so much on some magic. I would still require (set~ i 1) and (~
i) for these variables? With this approach you might want to consider
to change with-redo-varibles e.g.

(with-redo-variables (((~ a) 1)) code ...) 

to guard it in a redo safe manner and then

(with-redo-variables ((a 1)) code ...) 

as a normal variable and beeing a noop. Error checking can be done via
macros so now everything can be made ontop on a rich syntax system and 
r5rs.

Does this sounds like as a better approach?




> In particular, I think that having an MIT-Scheme-style fluid-let will
> do the right thing here. I would be interested in talking about its
> interaction with closure variables, but I think that it's the right
> thing here with regard to continuations and mutable state.
> 
> > BTW. srfi's shouuld be careful about specifying dynamic state in
> > order to achieve thread safe concpets, Scheme48 is threadsafe with
> > their fluid-let, guile would not be.
> 
> Yes, that's an interesting point.

I think that I will rewrite the specification with the help of
the assumption of the pressense of parameters srfi. I think that is 
smart.

/Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]