4 ms·
> no other language seems to come close in power for such a compile-time typed system D is far more powerful, especially when you consider that it's had workin
by mhh__ 6y ago
> no other language seems to come close in power for such a compile-time typed system
D is far more powerful, especially when you consider that it's had working constraints for (?) something like a decade now.
Simple example, try to express this in C++ without a windows full of syntax-soup (https://d.godbolt.org/z/Toc8ob https://d.godbolt.org/z/Toc8ob), the template constraint is one line, and I can pass anything into a template using alias be that templates, a string etc.
Passing strings into a templates is a very common trick for generating code at compile time in the D standard library, although it wouldn't work in C++ due to how slow C++ can be to compile some times.
- pjmlp 6y agoSadly, D the language still needs to get their act together in what the language actually wants to be, and the eco-system suffers from this lack of direction.
- nikki93 6y ago> Passing strings into a templates ... wouldn't work in C++ ... https://www.youtube.com/watch?v=QM3W36COnE4 https://www.youtube.com/watch?v=QM3W36COnE4 Here's an example of parsing regular expressions in C++ at compile time. Code here: https://github.com/hanickadot/compile-time-regular-expressions https://github.com/hanickadot/compile-time-regular-expressio...