GNU bug report logs -
#9844
peval & dynamic-wind
Previous Next
Full log
View this message in rfc822 format
I'm getting incorrect results in v2.0.3 when combining
dynamic-wind+call/cc with partial evaluation. In the program below, the
before-thunk is supposed to protect against reentry into the
body-thunk. However, with partial-evaluation turned on it doesn't error.
(define (test peval?)
(compile
'(let ()
(define (rewind-protect thunk protector)
(dynamic-wind
(let ((entered? #f))
(lambda ()
(if entered?
(error "Re-entering rewind-protected extent."))
(set! entered? #t)))
thunk
protector))
((call/cc
(lambda (k)
(rewind-protect
(lambda ()
(call/cc k)
(lambda _ 'not-supposed-to-happen))
(lambda () #f))))
#f))
#:opts `(#:partial-eval? ,peval?)))
;; scheme@(guile−user)> (test #t)
;; $1 = not−supposed−to−happen
;; scheme@(guile−user)> (test #f)
;; ERROR: In procedure scm−error:
;; ERROR: Re−entering rewind−protected extent.
;; Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
;; scheme@(#{ g256}#) [1]> ,q
;; scheme@(guile−user)>
If I place a (format #t "entered? ~s~%" entered?) before the (set!
entered? #t), I see
entered? #f
entered? #f
$2 = not−supposed−to−happen
which tells me that the earlier mutation isn't effecting later continuations.
--
Ian Price
"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"
This bug report was last modified 13 years and 219 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.