My thoughts on Rust and C++

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • rust

    Empowering everyone to build reliable and efficient software.

  • Regarding error handling, I think Rust's model is much superior to C++ exceptions. Code that can fail and code that cannot fail are different beasts, and in Rust the difference is clear. The advantage with Result compared to checked exceptions (a la Java) is that a result is a normal value which can be mapped, filtered, stored etc. I very seldom write code like in your match example, instead I use the ?-operator or map value or error to some other type (I doubt you've even looked at the API documentation for Result). Also, in the future there will be try blocks, but for the moment you can break out the code to a separate function if you want to use the ?-operator.

  • json

    JSON for Modern C++

  • It's also very often wrong. If you want evidence: panic! has the exact same behavior as exception throwing. Some data structures are left in incorrect or even UB states when you can terminate some of their algorithms at any point. See here, for an existing listing.Boost discusses this . But fails to note that RAII does not naturally provide basic exception safety, as data structure invariants are not preserved in its own implementation. Personally, both failure to mention in boost and the existence of this class of bugs is evidence that this effect wasn't understood well—so I very much have reservations if actual C++ libraries are designed with it in mind and tested against it. Very much doubt so, and if then with enormous effort. It's certainly not only happening in Rust: Evidence item 1. Personally, I don't know of any C++ project (besides the big three STL implementation) with enough coverage to confidently say simple things such as insert(It start, It end) are safe against an iterator implemention with exceptions in some of its operations.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • rfcs

    RFCs for changes to Rust

  • That's what's known as "anonymous sum types" or "anonymous enums" and there's been an open request for them since 2014. However, the RFCs that came in the interim, like RFC 402 and RFC 514, have surfaced issues that have yet to be satisfactorily addressed.

  • cppfront

    A personal experimental C++ Syntax 2 -> Syntax 1 compiler

  • Or Herb Sutter's cppfront:

  • carbon-lang

    Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)

  • You might want to check out carbon as it seems to alleviate a few pain points you have with rust and it s pretty much a “straight upgrade” from C++ with interoperability in mind. That said it’s in its early infancy and they even recommend using existing languages like golang, kotlin and rust if they match your requirements.

  • rustig

    A tool to detect code paths leading to Rust's panic handler

  • That's fair. I think I may just be a bit sore that Rustig was allowed to bit-rot and findpanics hasn't seen a commit since 2020.

  • findpanics

    Find calls to panic functions in rust executables

  • That's fair. I think I may just be a bit sore that Rustig was allowed to bit-rot and findpanics hasn't seen a commit since 2020.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts