On Thursday, 12 June 2014 at 10:40:56 UTC, Colin wrote:
Maybe a change to the compiler to write any mixin'd string out
to a temporary file (along with some identifier information and
the line of code that generated it) and at the next compilation
time try reading it back from that file iff the line of code
that generated it hasnt changed?
Then, there'd be no heavy work for the compiler to do, apart
from read that file in to a string.
Compiler can cache return value of function that get called from
inside mixin statement (for a given argument set). As CTFE is
implicitly pure (no global state at compile-time) later generated
code can be simply re-used for same argument set.
Re-using it between compiler invocations is more tricky because
it is only legal if generator function and all stuff they
indirectly use have not changed too. Ignoring this requirement
can result in nasty build issues that are only fixed by clean
build. Too harmful in my opinion.