34 ms·
Termination instead of divergence definitely is a change in semantics.
by jhgb 5y ago
Termination instead of divergence definitely is a change in semantics.
- cryptonector 5y agoNo, failure to fail is not a change in semantics. EDIT: "My program used to fail with a stack size exhaustion error, but now it works -- I'm so angry about this!" -no one ever.
- jhgb 5y agoBut they'd complain about the opposite -- for example if the program were an external-event-driven state automaton.
- cryptonector 5y agoTCO does not do the opposite. TCO helps avoid stack exhaustion without introducing new faults. TCO might cause your program to avoid one stack exhaustion fault only to reveal a different fault (possibly a different stack exhaustion fault). This is not a semantics change. And it's not a bug either.
- jhgb 5y agoWhat do you mean by "reveal a different fault"? A program with an indefinite amount of tail calls does not have "a fault".
- cryptonector 5y agoIf you have a program that fails due to stack exhaustion, but fixing it by enabling TCO causes it to run longer and therefore run into some other problem...
- jhgb 5y agoBut that's not a fault in the program. That's a fault in its execution environment revealed by the program.
- adrianN 5y agoC++ compilers are free to optimize infinite loops without side effects away and people are generally fine with that.
- jhgb 5y agoWell, I'm sure this is not the worst thing about C++ that C++ people are "generally fine with", so that really doesn't tell me a lot. Not quite sure if this applies to useful programs, though. Lack of tail call elimination can definitely break a class of useful programs even with side effects.