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

Re: a bug



	The order of evaluation of the expressions used to
	initialize bindings in LET is explicitly left
	unspecified in the Scheme standard, Section 4.2.2:

	    "Semantics: The <init>s are evaluated in the
	current environment (in some unspecified order), ..."

This is not the case.

I think SRFI-LET should show the same side effects and results
whether multiple values are used or not.  If not, srfi-let is not
compatible
with srfi-let itself, although it is compatible with r5rs-let.

> (define x 10)
>
(srfi-let ((a (begin (display "first") (set! x (+ x 1)) x))
	   (b c (values
		 (begin (display "second") (set! x 1) x)
		 (begin (display "third") (set! x 1000) x)))
	   (d (begin (display "end") (set! x (+ x 11)) x)))
	  (set! x 10)
	  (list a b c d))
secondthirdfirstend (1001 1 1000 1012)
>
(srfi-let ((a (begin (display "first") (set! x (+ x 1)) x))
	   (b (begin (display "second") (set! x 1) x))
	   (c (begin (display "third") (set! x 1000) x))
	   (d (begin (display "end") (set! x (+ x 11)) x)))
	  (set! x 10)
	  (list a b c d))
firstsecondthirdend (11 1 1000 1011)
>
(let ((a (begin (display "first") (set! x (+ x 1)) x))
      (b (begin (display "second") (set! x 1) x))
      (c (begin (display "third") (set! x 1000) x))
      (d (begin (display "end") (set! x (+ x 11)) x)))
  (set! x 10)
  (list a b c d))
firstsecondthirdend (11 1 1000 1011)

--
Joo ChurlSoo