This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: fluid-let


csk@cs.washington.edu (Craig Kaplan) writes:

>    Example, with C on the left and Scheme on the right:
> 
>         int x = 7;                    (define x 7)
>         int y = ++x;                  (define y (begin (set! x (+ x 1)) x))
>         int a = y + y;                (define a (+ y y))
> 
>     is _not_ equivalent to 
> 
>         int x = 7;                    (define x 7)
>         int a = (++x) + (++x);        (define a (+ (begin (set! x (+ x 1)) x)
>                                                    (begin (set! x (+ x 1)) x)))
> 
>     or worse yet,
> 
>         int a = (++7) + (++7);        (define a (+ (begin (set! 7 (+ 7 1)) 7)
>                                                    (begin (set! 7 (+ 7 1)) 7)))

As a side point, remember than in C/C++, we get few guarantees about the 
order of evaluation of expressions in the same statement.  The
translations to scheme are illustrate only one possible ordering -- for
the C language, no single order of evaluation can portably be assummed.

Greg