> it has associative arrays
Zig also has a variety of generic data structures in the standard library for this purpose, HashMap and ArrayHashMap and variants. The main limitation in the current implementation of comptime is that it can't handle heap allocations, so these can't be used at comptime yet. D has a garbage collector, which makes that sort of thing easier. It's also about fifteen years older, which also helps.
That limitation won't be there forever, though, this is just the immaturity I referenced in my first post.
But fair enough, you've convinced me: D is also a language which has improved on C++ templates using compile-time execution.
Looks like C++ itself is another such language! The last time I used it was well before the later constexpr and immediate mode function features described here existed. https://en.wikipedia.org/wiki/Compile-time_function_executio...
About comptime, it seems to me it's trivial to do that in D.
I started a little implementation of StringMap based losely on the Zig example, but I just did enough to show how D's templates and associative arrays could be used to implement that:
https://godbolt.org/z/o7GoobbKb
You can see that the creation of the map does not generate any Assembly, so it's run at comptime:
Notice that in D, "enum" can be used as a compile-time only variable, see https://dlang.org/spec/enum.html#manifest_constantsThe Assembly seems to be almost all related to the associative array implementation generated by the D compiler.
EDIT : if you want to try to continue the impl, have a look at the D's template tutorial: https://github.com/PhilippeSigaud/D-templates-tutorial/blob/...
D templates can do pretty much anything.