3 ms·
My only problem with C++ is that it’s too verbose. my eyes need to parse huuge chunks of things when I just want some convenient syntax for it. otherwise the id
by i_am_a_peasant 4mo ago
My only problem with C++ is that it’s too verbose. my eyes need to parse huuge chunks of things when I just want some convenient syntax for it. otherwise the idioms are pretty universal for most programming languages nowadays.
- tonyedgecombe 4mo agoThe trouble with that is the more mental capacity you exert on the language the less you have available for the task at hand.
- Zardoz84 4mo agoTry Java
- i_am_a_peasant 4mo agohard pass :D isn't kotlin supposed to be the future for JVM?
- speed_spread 4mo agoKotlin is the future of maintenance nightmare and Jetbrains lock-in.
- i_am_a_peasant 4mo agoseems to work for android though
- einpoklum 4mo agoC++ is quite amenable to making things less verbose. For example: Instead of a standard library algorithm taking a pair of iterators, you could have a function taking a container and calling the other function with its start() and end(). And then, with newer versions of the language, you can use a ranges-based function. There are lots of such syntactic hacks, from `using` through typed literals all the way to preprocessor macros (which we want to avoid, but are still there). That's how you emulate language features that aren't there originally. I've "impelemented" a static code block, like in Java: https://stackoverflow.com/a/34321324/1593077 https://stackoverflow.com/a/34321324/1593077 and that's all in C++98. The implementation is a bit ugly but the use is terse and self-expalantory.
- i_am_a_peasant 4mo agoThat's just terrible, I love it.
- spacechild1 4mo agoInteresting, I don't find modern C++ verbose at all. 'auto', range-based for-loops and structured bindings did a great job at reducing the verbosity of C++98. On top of that, C++ allows to design very concise APIs. (One of my favorite examples is sol2: https://github.com/ThePhd/sol2 https://github.com/ThePhd/sol2). Library code involving templates, on the other hand, can be pretty complex and hard to read. Concepts and other C++20 features (like [[no_unique_address]]) are certainly an improvement, but only new projects with no backwards compatibility requirements can actually use them (unconditionally).