• 0 Posts
  • 3 Comments
Joined 1 年前
cake
Cake day: 2023年11月10日

help-circle

  • Before using Rust I was using C++ for most projects and while it is a really powerful language there were some big problems:

    • no standard build system, most projects use cmake or meson and vendor dependencies with the projects. These build systems were really hard to learn (especially cmake, meson is easier). There are package managers these days such as conan and vcpkg but there is not really one standard way to build programs like in rust.
    • error messages were really hard to understand, especially when the project uses templates
    • it felt like 3 languages in one, projects written before c++11 differ greatly from c++11 and up
    • some of the new language features have really weird syntax, for example lambdas
    • some people say that rust is hard, but modern c++ is considerably harder to learn, just look at the list of modern c++ features: https://github.com/AnthonyCalandra/modern-cpp-features, you have to know the different pointer types (unique_pointer, shared_pointer etc.), templates, rvalue references and move semantic, exceptions, constexpressions and the list goes on

  • From my personal experience I can tell you 2 reasons. The first is that this is the first general purpose language that can be used for all projects. You can use it on the web browser with web assembly, it is good for backend and it also is low level enough to use it for OS development and embedded. Other languages are good only for some thing and really bad for others. The second reason is that it is designed around catching errors at compile time. The error handling and strict typing forces the developer to handle errors. I have to spend more time creating the program but considerably less time finding and fixing bugs.