On Thursday, 24 January 2013 at 13:59:43 UTC, David Nadlinger
wrote:
On Thursday, 24 January 2013 at 07:55:37 UTC, Jacob Carlborg
wrote:
On 2013-01-24 03:35, deadalnix wrote:
SDC does something similar with LLVM JIT capabilities.
That's the correct approach.
The question is not so much about correctness, but about
performance.
Building an LLVM function and JIT-compiling it every time you
need to evaluate a D expression will completely ruin your
compile times (and I say that as an LLVM proponent). The idea
itself is interesting for computationally heavy CTFE code, but
I don't think it is feasible to go without lightweight code at
least for simple »constant folding«-type applications.
This is what SDC does currently, but yes, simple constant folding
should avoid doing that.
But 1/ make it work and 2/ make it fast.
Current implementation permit easily to add constant folding
later.