Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Interesting that I also am learning c++ since some months and I have a very similar feedback as you.

Just to add something:

> - C++ 20 concepts are a near mirror copy of Rust Traits and enable composition that's an alternative to inheritance, again difficult to find examples of

I don't know Rust, but they remind me of Scala traits. I guess it's conceptually the same, and Scala comes first :)

> - The features that make C++ decent are often found in C++ 20/23, for which there are woefully few resources

Somehow yes, but I think lots of cool things happened in 11 and 17. At least when I read the docs, it seems so. C++20 seems to have simplified and ported a lot of more modern features to the language, though. But 11 was a game changer from my understanding.

> - Dependency and package management is a nightmare. Need to condense CMake + vcpkg into a Cargo like tool and make it a standard

Tooling is indeed something that requires a sort of unofficial community decision to say "just start with this and this". That's so true! But that also goes against the main philosophy of C++ which makes it so super cool!

> - flags like "-fsanitize=address,leak,undefined -fanalyzer -Wthread-safety -D_FORTIFY_SOURCE=" should be baked in to a default "dev"/"debug" mode newbies shouldn't need to know/think about

Did you try project_options[0]? I recommend it to all newbies like me. Just set the "enable_developer_mode=true" and you get all that stuff for free.

> - I have to Google what headers cstd/std stuff comes from half the time

In Clion you can cmd+click on the symbol and it leads to the header.

As a final note, another recommended resource is https://github.com/cpp-best-practices/

[0]: https://github.com/aminya/project_options



> I don't know Rust, but they remind me of Scala traits. I guess it's conceptually the same

Rust's traits are typeclasses. Scala's traits are like Java interfaces but more.


Rust's dynamic traits are like Java or C# Interfaces.

Rust's Static traits are used like C++ templates but with more compiler checks and guidance.

In both cases, you can separate the code that implements the trait from the class itself (like a partial class). In Rust you can also retroactively declare a trait and then implement that trait for a class you like (even someone else's class, or a standard class).


you're right, Scala has also type classes, though. Generics, traits, variance, etc., are all quite sophisticated in Scala. I wouldn't say it's taken from Rust. The idea had been there for a while.


That project options tool is pretty neat, thanks for sharing!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: