On Sunday, 4 September 2016 at 19:36:16 UTC, Stefan Koch wrote:
On Sunday, 4 September 2016 at 12:38:05 UTC, Andrei
Alexandrescu wrote:
On 9/4/16 6:14 AM, Stefan Koch wrote:
writeln and __ctfeWriteln are to be regarded as completely
different
things.
__ctfeWriteln is a debugging tool only!
It should not be used in any production code.
Well I'm not sure how that would be reasonably enforced. --
Andrei
One could enforce it by defining it inside a version or debug
block.
The reason I do not want to see this in production code is as
follows:
In the engine I am working on, communication between it and the
rest of dmd is kept to a minimum, because :
"The new CTFE engine abstracts away everything into bytecode,
there is no guarantee that the bytecode-evaluator is run in the
same process or even on the same machine."
An alternative might be, to save your ctfe values in an static
array and output them on startup of the compiled program. Same
idea is used in vibe.d to make a caching of the templates
evaluation possible. See: http://code.dlang.org/packages/diet-ng
Experimental HTML template caching