4 ms·
> Personally I judge code quality by a) Functionality (does it work, is it safe?), b) Readability c) Conciseness d) Performance and e) Extendibility, in this or
by MauranKilom 6y ago
> Personally I judge code quality by a) Functionality (does it work, is it safe?), b) Readability c) Conciseness d) Performance and e) Extendibility, in this order, and I don't see how these new features in reality help move any of these meaningfully in the right direction.
I don't understand... How do these features not address those points?
> a) Functionality (does it work, is it safe?)
constinit, consteval and all the remaining constexpr improvements are a massive step for ensuring the "compile-time-ness" of code:
https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.html#constinit https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...
https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.html#constexpr-features https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...
There's several more sharp edges being removed too. It's of course not going to tackle the fundamental safety concerns the way Rust is doing, but that would be a new language (like Rust is) anyway.
> b) Readability
requires is infinitely more readable than the SFINAE we had to write so far:
https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.html#concepts https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...
Besides that elephant in the room, most of these changes involve making the code either simpler to read/write (too many to name) or more explicit (consteval/constinit, attributes, ).
> c) Conciseness
Half the features contribute to this in one way or another (e.g. see previous point, or the spaceship operator), but there's also a whole list of syntactic sugar being added:
https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.html#sugar https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...
> d) Performance
What about coroutines?
https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.html#coroutines https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...
> e) Extendibility
Various fixes to customization points:
https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.html#fix-structbind-cp https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...
https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.html#fix-range-for-cp https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...
- dgellow 6y agoRegarding "Readability", you mentioned requires (which is great), but ranges and views also make everything so nicer to read!
- MauranKilom 6y agoTrue, C++20 also comes with great library additions that are not the subject of this blog post but affect (possibly to an even greater degree) the code attributes in question.