[r6rs-discuss] Laziness Features - reentrancy

From: Marcin 'Qrczak' Kowalczyk <qrczak>
Date: Wed Oct 18 14:40:09 2006

AndrevanTonder <andre_at_het.brown.edu> writes:

> However, I would like to suggest a bullet option allowing
> implementations to throw an exception for reentrant promises,
> reading as follows:
>
> - An implementation may raise a runtime contract violation
> if a promise refers to its own value, i.e., if forcing a
> promise may cause the promise to be forced a second time
> before the value of the first force has been computed.

I agree; this could even be mandatory.

In a language with concurrency the desired effect of many cases of
promises, when evaluated concurrently by separate threads, is for
other threads to wait until the value gets computed by the thread
which started it first.

If the thread wanting the value is the same as the thread which is
computing it, letting it wait for itself would be sound but pointless,
it would just deadlock. This generally signifies a bug in the program
where a value depends on itself. A more useful behavior is signalling
an error.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak_at_knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/
Received on Wed Oct 18 2006 - 14:39:47 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC