bug-guile
[Top][All Lists]
Advanced

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

bug#9844: peval & dynamic-wind


From: Ian Price
Subject: bug#9844: peval & dynamic-wind
Date: Sun, 23 Oct 2011 12:48:43 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

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"





reply via email to

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