Re:A quick primer on type traits in modern C++
by TeMPOraL on Tuesday March 03, 2020 @06:36PM
(#22479801)
I think there's a point in rjeli's and skrebbel's comments though. This wasn't designed in from the get go; it started as a hack that got papered over with abstractions and accepted as a standard practice. Despite later improvements, the whole thing still has the aftertaste of a clever hack.
Using a modern example, the way template metaprogramming started feels like return-oriented programming, or those "MOV is Turing-complete" or "MPU error handling is Turing-complete tricks". Someone figured out the standard unintentionally lets you make a conforming compiler do computations, and it ended up becoming an accepted feature, instead of updating the language to something resembling modern constexprs, or Common Lisp's compiler macros.
Sure you can write spaghetti code, but you can do that in almost any language. And there are popular languages that had explici design goals of limiting expressiveness in the hope of reducing spaghetti code (Pascal, in its time, and go today). I consider it like a balloon: without that power you end up with more boilerplate and repeated code, which to me makes following the code harder. But other people reasonably disagree.