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

Re: [Scheme-reports] Promises that force themselves



On Fri, Feb 8, 2013 at 2:03 PM, John Cowan <cowan@x> wrote:
Alex Shinn scripsit:

> > Arguably, the "first time" the promise is forced is at line 9 in the
> > example, and the "second time" is at line 6.  However, at that time
> > line 6 gets executed, no value has been computed *yet*, so presumably
> > this example follows the spirit of the law.

[snip]

> The example in question has been in the report since R4RS, so we can't
> change this without breaking compatibility, and can't do that without
> good reason.

Prose trumps examples, though, and the prose really is ambiguous.

When the prose is ambiguous, the examples are there to
disambiguate.  Moreover, the reference implementation makes
this clearer.  The semantics are that the first (temporally)
_returned_ result is memoized, regardless of call order.

We should probably improve the prose though.
 
It's not clear whether the value of a forced promise is determined at
the beginning of the force or at its end, which makes it unclear whether
the first time is really at line 6 after all.  That's quite independent
of threading considerations.

Right, threading is unrelated and was only brought up as a
motivation for why a certain semantics might be desirable.

-- 
Alex

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports