> Thomas Lord wrote: >> Joe Marshall wrote: >>> Paul Schlie <[EMAIL PROTECTED]> wrote: >>> >>> Thereby although creating a logical loop testing for a termination >>> condition prior to returning a value and thereby enabling control >>> flow to proceed, may not be the best way to temporally synchronize >>> program execution to external events, it's seemingly valid; and >>> thereby seemingly only valid to optimize away evaluation if it can >>> be proven to terminate exclusively based on synthetic state values >>> within the context of the logical program, and not values imported >>> from the outside world through I/O ports or other similar means for >>> example. >> >> This seems weird. If I were to write a loop that just ran for timing >> purposes, I'd be insane to run it through an optimizing compiler. >> >> As it stands, collatz conjecture hasn't been proven, but no divergent >> value has ever been discovered. Would it be ok to optimize out the code >> for the cases for which it is known to converge?
- personally, only if the compilation of collatz determined that its temporal behavior and value termination state is not dependent on external values/events. Which in practice seems fairly easy in the general case, as the presence of any conditional termination condition based on an externally controllable value/event, such as being dependent on the return of a value through a port, would preclude collatz from being optimized away (as otherwise one could arguably optimize away elements of a REPL, which presumably would not be desirable) >> proof were found, would it be ok to optimize out the call in that case? - yes, although I doubt that one could ever prove sequential temporal insensitivity without claiming omnipotence. >> Would it be ok even if someone wrote timing code that depended on such >> a proof not being found? - personally no, as otherwise the optimizer is for a different language. > Joe, I think he is saying that all low-level port-events should be > defined to be well-ordered points on a hypothetical world-line of > a single program run and that the semantics of the order-of-execution > partially determine that ordering. Because low-level port events are > externally observable, they can't be optimized away and, in the view > he's expressing, have to occur in one of the expected orders. - yes > I tried for a while to argue against that but came to the conclusion > that Paul is right. Even an optimizing compiler should be sensitive > to the observable side effects implied by the semantics. > > But I don't disagree that the whole topic is "weird", at least > to the extent that that is roughly synonymous with "interesting" > or "fascinating". - not really so weird, although arguably not a great coding practice; but in the absents of standardized language alternatives, it should be honored. > You could still build an optimizing compiler that didn't honor > this restriction and it could still be very useful -- but it should, > in this view, come with a warning that it may not compile some > portable programs faithfully. - personally, an optimizing compiler should honor all language semantics _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
