Merge pull request #341 from stibear/lazy2
fix promise bugs on corner cases (second one)
This commit is contained in:
commit
15f048d0da
|
@ -24,9 +24,12 @@
|
|||
(if (promise-done? promise)
|
||||
(promise-value promise)
|
||||
(let ((new-promise ((promise-value promise))))
|
||||
(set-promise-done! promise (promise-done? new-promise))
|
||||
(set-promise-value! promise (promise-value new-promise))
|
||||
(force promise))))
|
||||
(if (promise-done? promise)
|
||||
(promise-value promise)
|
||||
(begin
|
||||
(set-promise-done! promise (promise-done? new-promise))
|
||||
(set-promise-value! promise (promise-value new-promise))
|
||||
(force promise))))))
|
||||
|
||||
(define (make-promise obj)
|
||||
(if (promise? obj)
|
||||
|
|
|
@ -363,7 +363,15 @@
|
|||
(force x)
|
||||
(promise? x)))
|
||||
|
||||
|
||||
(let ()
|
||||
(define flag #f)
|
||||
(define p (delay (if flag
|
||||
'ok
|
||||
(begin
|
||||
(set! flag #t)
|
||||
(force p)
|
||||
'ng))))
|
||||
(test 'ok (force p)))
|
||||
|
||||
|
||||
(define radix
|
||||
|
|
Loading…
Reference in New Issue