It would be nice if we can use import expressions in __ctfe context as shown below. run.dlang.io: https://t.co/ui274K3Vqa?amp=1 ```dlang import std; void main() { enum str = load(__FILE__); } auto load(string path) { if (__ctfe) { return import(path); } else { return readText(path); } } ``` It fails to compile with the following message: ```console > rdmd playground.d onlineapp.d(12): Error: variable `path` cannot be read at compile time ```
The supplied code never enters CTFE because semantic analysis fails with the aforementioned error. See https://wiki.dlang.org/User:Quickfur/Compile-time_vs._compile-time