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

Clarification to force needed

I am sending this to both lists, though I don't know if this is a
problem in the ANSI spec.

I believe that the current definition of (force <promise>) could use
some rewording to make it clear that FORCE is only entitled to memoize
when the promise has returned.  That is, the sequence:

	(set! expr (delay (if get-out (escape^ #f) #t)))
	(call/cc (lambda (cont)
                   (set! escape! cont)
		   (set! escape #t)
		   (force expr)))
        (set! escape #f)
	(force expr)

A problem can arise if forces change their type codes too early.  The
intent is that if executing a force succeeds everything is fine, but
that one is entitled to restart a force that has been thrown out of.
My intent is also that 

     (set! fred (delay (begin ... (force blah) (throw...))))
     (force fred)

is entitled to memoize blah if it succeeds, even if the overall delay
FRED is thrown from.

I believe this was the original intent, but it would be useful to make
the behavior outlined above explicitly correct in the standard.

Jon Shapiro
Stanford University