[r6rs-discuss] [OT] Should compilers preserve termination?

From: Paul Schlie <schlie>
Date: Fri Mar 9 12:46:29 2007

> bear wrote:
> ...
> I think we come down to this point, and my final recommendation
> on the matter - which is more broadly applicable than just talking
> about nontermination itself. The standard needs to say explicitly
> that if an implementation can prove that there is only one possible
> return value from an error-free execution of some code, then
> it may elide the execution of the code and return that value.
> ...

(let wait-for-x () (if (not (eqv? (read-char) #\x)) (wait-for-x)))

for example, can never be justifiably optimized away regardless of
it's resulting value (if any).

(As such expressions have both temporal and value state side effects;
 i.e. prevents execution from proceeding until some externally controlled
 event occurs, and modifying the sequential value state of port stream
 by in this example consuming all sequentially preceding characters and
 thereby modifying the port's logical state.)

or obviously otherwise relegating scheme useless for writing programs
interacting with the real world beyond that synthetically known within the
scope of the program specification itself; such as required by real-time
control and many classes of low-level communication protocols for example;
and thereby likely not prudent to allow unless provably side-effect free.
Received on Fri Mar 09 2007 - 12:45:28 UTC

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