[gambit-list] question about implementation of force
Dimitris Vyzovitis
vyzo at hackzen.org
Sun Mar 25 03:45:13 EDT 2018
Marc,
in _std.scm you have the following code implementing force:
(define-prim (##force obj)
(if (##promise? obj)
(let ((result (##promise-result obj)))
(if (##eq? result obj)
(let* ((r ((##promise-thunk obj)))
(result2 (##promise-result obj)))
(if (##eq? result2 obj)
(begin
(##promise-result-set! obj r)
(##promise-thunk-set! obj #f)
r)
result2))))
;; XXX -- value is unspecified when (not (##eq? result obj))
obj))
I find it very strange that the first if eq test of the result to the
promise is lacking the else part;
that's where I marked with XXX.
Shouldn't the code return result in this case?
What am I missing here?
-- vyzo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20180325/8fc27f49/attachment.htm>
More information about the Gambit-list
mailing list