On 06.04.19 16:19, Alex wrote:
That is CTFE is CT RTFE where runtime functions are executed at compile time when the inputs are CT.

You may have the right idea, but the last part of that sentence is wrong/misleading. CTFE happens when the result is required at CT. The inputs must be available at CT, but that alone doesn't trigger CTFE.

Examples:

----
bool f(string s) { return __ctfe; }
void main()
{
    import std.stdio: readln;
    enum x = f("foo"); /* CTFE */
    enum y = f(readln()); /* error, because "readln" can't be CTFEd */
    auto z = f("foo"); /* not CTFE */
}
----

Reply via email to