Why CTFE is context-sensitive?

Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com> Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Mon Jan 27 13:37:56 PST 2014


On Monday, 27 January 2014 at 21:12:30 UTC, deadalnix wrote:
> lolwut ? How do you make the difference between a program that 
> won't terminate ever and one that will terminate eventually 
> (say, in several years) ?

1. The halting problem does not apply to finite resources. The 
proof is trivial: just record all state. You are in an infinite 
loop when you revisit a state your program already has been in. 
The halting problem only applies if you have non-finite storage.

2. You can set a timeout and use heurististics (and profiling) 
for what computations you want to try to precompute. Perfectly 
doable.


More information about the Digitalmars-d mailing list