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>
Tue Jan 28 01:42:01 PST 2014
On Monday, 27 January 2014 at 22:40:19 UTC, Simen Kjærås wrote:
> My computer has 16GB of RAM. You try keeping track of all the
> possible states.
Wrong reasoning.
The issue is that the proof for the halting problem does assume
non-finite resources. That means that the proof that you cannot
prove termination for an arbitrary program does not hold for
programs that run on your computer. :^)
Anyway, the reasoning does not hold anyway, because there is an
inifinite number of programs that can be proved to terminate… So
you just do those instead!
> computers. It's technically true, yes. It also does not matter,
> for the reason described above.
When people try to be theoretical smartasses they should fess up
to a theoretical response!
From a pragmatic position speculative precomputation is quite
acceptable, works well with profiling on typical datasets and
whole program analysis.
Even if the compution does not terminate you can run it as far as
you can and then freeze the result, and use that as a starting
point.
A cheap version of this has been used for decades to speed up
program initialization: run the program until it reads input,
then core dump. Run a program on the core dump that turns it into
an executable. This is a nice way to speed up the initialization
of interpreted programs. Java needs this badly!
> Lastly, deadalnix didn't even bring up the halting problem, so
> why even mention it?
He did implicitly, it was referenced in d.learn. This thread runs
in two forums.
Ola
More information about the Digitalmars-d
mailing list