On May 13 2013, Jörg F. Wittenberger wrote:
Peter Bex has pointed out that my example in http://lists.nongnu.org/archive/html/chicken-hackers/2013-05/msg00031.html was not very clear about the problem at hand; let my clarify.
...
NB: Things would be even stranger, if we would cause the promise "p" to raise an exception for most results of (random 1000).Thus `delay` and `force` behave as my intuition would suggest *only* if `force` is called from the same thread, which produced the promise using `delay`.
Attached a test case, which shows that promises raising exceptions are also evaluated more than once, even when there is only the primordial thread involved. According to my understanding this clearly violates at least the r7rs draft. Best /Jörg .......
(define p (delay (error (random 1000)))) (define (force/catch p) (handle-exceptions ex (with-output-to-string (lambda () (print-error-message ex))) (force p))) (define input (list p p p p)) (display (map force/catch input)) (newline) (exit 0)
_______________________________________________ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers