justinethier/cyclone

`guard`'s cond clauses evalued in unexpected dynamic environment

okuoku opened this issue · 1 comments

tested: cf66cf1

It seems guard syntax evaluates its cond clause s in wrong dynamic environment. e.g.)

(define p0 (make-parameter 1))
(guard
  (c (#t
      (display (list (p0) '== 1)) (newline)))
  (parameterize ((p0 2))
                (display (list (p0) '== 2)) (newline)
                (raise 'unused)))

should print

(2 == 2)
(1 == 1)

but it prints

(2 == 2)
(2 == 1)

R7RS specifies dynamic environment here as:

That implicit cond expression is evaluated with the continuation and dynamic environment of the guard expression.

Thanks for the report @okuoku, I'll look into this.