3 ms·
> For example, templates were for sure complex, and they're very much a complete feature. That is, they haven't been made more complex over time. I agree with
by kllrnohj 4y ago
> For example, templates were for sure complex, and they're very much a complete feature. That is, they haven't been made more complex over time.
I agree with your broader point but parameter packs (aka, variadic templates) were an addition to templates made in C++11. So strictly speaking they have gotten more complex.
- fluoridation 4y agoFair enough, but that addition wasn't to solve the problem of templates being too complex, but to support usages that were previously impossible.
- usrnm 4y agoThey were possible and widely used, but a lot less ergonomic. You "just" had to copy-paste some number of instantiatons for the number of arguments between 0 and, say, 50.
- fluoridation 4y agoWasn't it also at the cost of compilation memory? I still remember the time when it was easy to crash compilers by just giving them hard enough templates.
- cbsmith 4y agoI mean, that's just the tip of the iceberg. Templates have evolved a great deal over time, and continue to do so (C++20 added Concepts).
- kllrnohj 4y agoConstraints and concepts don't increase the scope or feature set of templates, which was GP's broader point. That is, all the additions are around things that are a smaller, but easier to use, subset of the broader feature. `if constexpr` for example just being a way more approachable std::enable_if, not an expansion of the feature set. And concepts then are about clarifying the contract of the template, they don't actually add new capabilities. It'd be I think reflection, however that ends up looking, that's the next actual feature set expansion of templates.
- cbsmith 4y agoThey added a whole new keyword just to support it. Just because C++ templates are Turing complete doesn't mean new features don't count as new features.