by WalterBright · 7y ago · 0 comments
Here's some code that initializes an array at compile time with a non-trivial computation:
https://github.com/dlang/dmd/blob/master/src/dmd/backend/var...
This used to be initialized by a separate program that generated some .d files. It was nice to get rid of that. Even better, if you check the generated object file, there's no trace of the code used to generate the array - just the data for the array.
I agree that generating an array at compile time is perfectly fine. I was saying that I/O should be restricted in compile-time computation, which the person I was responding to made me believe was entirely unrestricted in compile-time computation in D.