4 ms·
I'm surprised by this take. C++ requires you to duplicate signatures in header files, which that alone requires a good degree of boilerplate. Modern C++ offers
by suby 4y ago
I'm surprised by this take. C++ requires you to duplicate signatures in header files, which that alone requires a good degree of boilerplate. Modern C++ offers some tools to be more terse such as keywords like auto, but often times the "proper" way of doing things is the more verbose way. This is a bit of a strawman, but
[[nodiscard]] constexpr int Add(const int& a, const int& b) const noexcept
{
return a + b;
}
- bpye 4y agoI guess modules help this a little right? I haven’t used them for anything non-trivial so perhaps I’m overly optimistic.
- mpyne 4y agoThat example has nothing to do with modules. It doesn't even use templates (where concepts would help at least) or the "noexcept(noexcept(...))" thing. Modern C++ does help with most type specification, looping over containers, writing constructors and making value classes. It's definitely not all bad, but there's still a lot of boilerplate to C++.
- bpye 4y agoSorry, I was thinking of modules in response to > C++ requires you to duplicate signatures in header files, which that alone requires a good degree of boilerplate.
- suby 4y agoModules will definitely help but even modules unfortunately aren't perfect. You aren't allowed to have circular dependencies with modules, you need to forward declare. It's less boilerplate but still unfortunate imo.
- noobermin 4y agoauto is part of the language for reason.