Having to mark everything as evaluatable at compile time is a stupid, stupid, decision that only C++ could think was a good idea.
A change of an implementation detail in some leaf function (that happens to add a run-time dependency) should not accidentally break execution of another function elsewhere (possibly in a different downstream project) that happened to work as compile-time before that.
Note that compilers are still free to execute pure functions opportunistically at compile time, but it's just not guaranteed.
>D should worry less how great language it is,
You are just replying to some guy expressing an opinion on internet about how to do something better, and using D as example.
> Eschew flamebait. Avoid unrelated controversies and generic tangents.
You responded to
> Having to mark everything as evaluatable at compile time is a stupid, stupid, decision that only C++ could think was a good idea.
with
> D should worry less how great language it is, focus on fixing long standing DIPs and compiler bugs, and actually have an ecosystem that makes it worthwhile using in the industries where C++ is the first choice.
Definitely qualifies as both "flamebait" and "unrelated controversies".
Now if I happened to reply to the wrong comment, sorry about that, and I should pay more attention before replying.
What is stupid about it? It makes a lot of sense given how programming languages work.
I was hoping to be able to do things like generate type safe classes from a database schema but the current limitations mean you have to fall back to shell scripts, which zig-build also appears to not support.
Even in this thread everyone is code golfing fizzbuzz instead of something more practical.
Though on the other hand I'm using compile Nim code to parse CMake files and provide static types for configuration values. It's super easy in Nim between macros and const's. Here's a ~170 lines of code where I'm compile time checking that my Nim code can compile time check against the current build configuration of Zephyr RTOS https://github.com/EmbeddedNim/nephyr/blob/main/src/zephyr_c...
I get that this differs from normal file io, but I could argue that is in line with Zig motto of clarity.
Also you would of course suddenly have to have the file content as part of your binary. Maybe you were hoping to be able to throw that away after you generated what you wanted...?
Ultimately if you go down that path, whatever would be supplying the file could just as easily (or perhaps easier) be supplying zig code and you're still reliant on some sort of per-processor.