Hacker News new | ask | show | jobs
by cfstras 975 days ago
Most languages with macro or templating should be able to define this behavior as a library. Rust and C++ come to mind, for example.
1 comments

Can you provide an example of a Rust HTTP routing library that can generate a compile-time error for overlapping routes?
I don't know of one, but you seemed to doubt not that it's actively being done, but that it's even possible, which is a very different proposition.

Remember C++ actually implements checks at compile time for the modern std::format function. That is, if you mess up the text of a format string so that it's invalid, C++ gives you a compile time error saying nope, that's not a valid format.

You might think that's just compiler magic, as it is for say printf-style formats in C, but nope, works for custom formats too, it's (extremely hairy) compile time executed C++.