Re:Std::visit is everything wrong with modern C++ (2017)
by jandrewrogers on Sunday December 06, 2020 @01:43AM
(#25321660)
That’s the beauty of the evolution of C++. Metaprogramming has become increasingly maintainable, as making it a first-class capability of the language is a core focus of the people designing it. The learning curve is finally low enough that it is practical. I think it is fair to say that C++17 is the first version where that is true.
You can’t write a comparable database engine in Go, fundamentally. The language lacks features required for competitive performance. The code difference will be much more than 50% trying to get the most out of what Go is capable of in this domain.
The point of writing code this way isn’t to be clever or for a “thrill”, it objectively produces superior performance, reliability, and maintainability. Defects scale with the number of lines of code regardless of language. Type safe code gen is a powerful tool.
Re:Std::visit is everything wrong with modern C++ (2017)
by krelian on Sunday December 06, 2020 @10:51AM
(#25324254)
>The learning curve is finally low enough that it is practical. I think it is fair to say that C++17 is the first version where that is true.
What are the specific C++17 features that make this a reality?
Re:Std::visit is everything wrong with modern C++ (2017)
by coliveira on Sunday December 06, 2020 @01:24PM
(#25325376)
Just look at the new features in C++17 that simplify the use of templates, like variadic templates, constexpr everywhere, automatic type detection working together with templates, etc. The last versions of C++ are mostly about making using templates easy, which allows programmers to operate at a different level than languages such as Go and Python.
Compare to writing a database system in something like Go. Sure you make end up with 50% more code, but you could have anybody up and running reading and understanding the code within 3 days.
IBM have done studies of this and found that fancy code is not all that valuable. It ends up falling in disuse over time as people don't get it. I have seen my fair share of C++ code which simply had to be tossed because nobody at the company could understand what the previous whiz kid had written.