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

Re: Bug fix

Andre van Tonder wrote:
Thank you to Alexandro and John for pointing out the bugs in the
implementation.  I have fixed them and included the suggested extra
tests in the update below.

(define (force promise)
   (let ((content (unbox (unbox promise))))
     (case (car content)
       ((eager) (cdr content))
       ((lazy)  (let* ((promise* ((cdr content)))
                       (content  (unbox (unbox promise))))

Shouldn't that last line use promise*? If so, how come your tests pass?

(when (not (eqv? (car content) 'eager)) ; for reentrancy test 3
                    (set-box! (unbox promise) (unbox (unbox promise*)))
                    (set-box! promise* (unbox promise)))
                  (force promise))))))