[r6rs-discuss] [OT] Should compilers preserve termination?
> On Fri, 9 Mar 2007, Paul Schlie wrote:
>
>>> 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).
>
> Right. Good catch. Does
> s/error-free/error-and-side-effect-free/
> fix the problem?
As it's not clear to me that non-error-free code may be optimized away
unless it is provably known to never be reachable, as the error/exception
should be observable if reached; it seems that the only expression whose
code evaluation that may be optimized away are:
- unconditionally-non-observable/reachable
- or known-substituted-value-fully-side-effect-free
Received on Fri Mar 09 2007 - 14:35:13 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC