guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Order of the evaluation of elements in a quasiquote list.


From: rm
Subject: Re: Order of the evaluation of elements in a quasiquote list.
Date: Sun, 3 Apr 2005 13:59:06 +0200
User-agent: Mutt/1.5.3i

On Sun, Apr 03, 2005 at 01:38:04PM +0200, Kjetil Svalastog Matheussen wrote:
> On Sun, 3 Apr 2005, Neil Jerram wrote:
> 
> > Kjetil Svalastog Matheussen wrote:
> > > Hi, I have recently stumbled upon various bugs in my code
> > > because the order of the evaluation of the elements in a quasiquote
> > > list changes.
> > 
> > Changes how?  Can you give us an example, to make things concrete?
> > 
> 
> Sorry, this is the stripped down version of the cause of the bug I'm 
> finding various places:
> 
> (let ((a 1))
>   `( ,(begin (set! a 2) a)
>      ,a))
> -> (2 1)
> 
> 
> Wouldn't it be better if this one returned (2 2)?

Why do you think that "(2 2)" would be _better_? (How do you define
"better" ?)

> Also, I'm seeing different behaviour in the order of evaluation between
> 1.6.4 and 1.7 (doesn't have the code available now). I think that is
> really bad actually...

You get what you ask for: did you do a "manual" expand of your code?
This result in the following form:

     (list (begin (set! a 2) a) a)
                 
 =>  (list 2  1) | (list 2 2)

depending on the order of evaluation of function arguments, and, please,
since you read c.l.scheme: there's not to be argued about here :-/
So guile changed the order of evaluation for function arguments - that's not
good or bad. There is no reason why the implementors shouldn't do this, after
all, that's the whole point of leaving evaluation order unspecified (so 
implementors
can safely do this).

hth Ralf Mattes

> -- 
> 
> 
> 
> _______________________________________________
> Guile-user mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/guile-user




reply via email to

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