Hello Khudyakov,
Saturday, February 21, 2009, 2:07:39 AM, you wrote:
> I have another question. Why shouldn't compiler realize that `sum [1..10^9]'
> is constant and thus evaluate it at compile time?
since we expect that compilation will be done in reasonable amount of
time. you cannot guarantee this for list-involving computation
it would be nice to have a compiler that can run forever, incrementally generating faster and faster versions of the same program, until you press a key or a timeout is reached.
then you just let it run before you get to bed ;-)
you could even pass it in a test data set to which it must be optimized; after the program is compiled, the compiler runs and profiles it, measures the results, and does another pass to make it faster.
some C++ compilers can already do this (profile based optimization).