Live data from Hacker News

I think C++ is still a desirable coding platform compared to Rust

lucisqr.substack.com

51–60 of 110 posts

Re: I think C++ is still a desirable coding platform compared to Rust

#51

Rust is not competing against a stale competitor. C++ has evolved quite significantly. Competition is good and things are improving for everyone. That said, it’s not challenging to write modern c++ without coming across raw pointers or buffers.

Yeah, C++ has evolved quite a lot.

That being said, porting existing codebases from "old C++" (say And I know that I've jumped ship from C++ to Rust a while ago. Right now, I don't see any compelling reason to go back.

Re: I think C++ is still a desirable coding platform compared to Rust

#52
I used to be very comfortable in C++... then I stepped away for ~7 yrs. Now I'm back and I loath it. I loath that there are so many ways to wrap a pointer. The built in ones like shared_ptr, unique_ptr, etc and then all the per-project ones. On opt of which there's now std::move etc and I always need to know when to use one vs the other and when to call move vs when not and all the rules related the project's own pointer types. It really really sucks and I'm never sure I'm not breaking some rule. I'm shocked that when I was more comfortable with C++ that I didn't notice this glaring issue in front of my face.

I'd much rather have a language that just "does the right thing" and or at least prevents me from doing the wrong thing. Not just leaves it as an exercise to the user to pray and hope they get it right.

I haven't had the opportunity to use rust yet but one thing I think I look forward to is a more standard way to deal with dependencies and standard built tools. languages that have a popular package manager have their issues with people using too many dependencies and possibly easier supply chain attacks but dang it's night to just get shit done and not have to futs with makefiles, CMake, Ninja, Scons, auto-config, XCode projects, Visual Studio projects, etc...

Re: I think C++ is still a desirable coding platform compared to Rust

#53

Yeah, that's a no from me. I'm a full time C++ dev and every time I code in Rust it is harder for me to switch back. The author has pointed to some issues regarding performance. In the end, you can always rewrite your code to generate other/better assembly, if you really need the speed. I would argue Rust is so much more that just Rust itself. Like many others after noted, it is not only the language, but the whole e…

    rustup target add wasm32-unknown-unknown
    cargo build --target wasm32-unknown-unknown

    rustup target add x86_64-unknown-linux-musl
    cargo build --target x86_64-unknown-linux-musl

    rustup target add x86_64-pc-windows-gnu
    cargo build --target x86_64-pc-windows-gnu
Boom, killer feature right there.

Re: I think C++ is still a desirable coding platform compared to Rust

#55
post #3

I've done some C++ but no Rust. I'd like to learn a few things from people who have done both. 1. How many years of C++ programming do you have under your belt? How many years of Rust? 2. For new work projects, do you choose C++ or Rust? Why? 3. For new hobby projects, do you choose C++ or Rust? Why? 4. Is there something about C++ that you wish Rust had? 5. Is there something nice about Rust (apart from the borrow c…

1. I had about 7 years of professional C++ experience, a few more as a hobbyist. By now, I have ~10 years of Rust.

2. I would definitely choose Rust. For better or for worse, the teams I work with tend to consider developer velocity as their highest metric. Between cargo, clippy, crates and the type system, I'm orders of magnitude more productive in Rust.

3. Same thing. My life is too short to spend it debugging memory or concurrency errors.

4. There are a number of C++ libraries that have no equivalent or good bindings in Rust yet. But if you're talking of the language, no. There are C++ features that do not have an equivalent in Rust but I don't miss them.

5. From the top of my head, affine types (e.g. after a `std::move`, the type system ensures that you can't use the value anymore), proper enums, proper pattern-matching, better concurrency operations in the standard library (which pretty much requires affine types), a linter as good as clippy, built-in support for writing new linters/gradual type systems, derive macros (that have access to the AST).

Re: I think C++ is still a desirable coding platform compared to Rust

#56
> "Why I think C++ is still a desirable coding platform compared to Rust"

And yet, C++ remains an undesirable coding platform, for the reason alone that there is no package manager. It's difficult to take this blog seriously when there is not even a faint mention of Cargo.

But even beyond that, I have other gripes with other fundamental points of the author's case:

> But is that an apples-to-apples comparison? Well, yes, if you are going to list the “safety” of Rust compared to C++ as a pro, then it’s just fair to list the performance hit of such safety in regards to execution speed.

Making this claim without any numbers to back it up is a very bold move. In fact, looking at benchmarks you can see that Rust can be faster in a fair number of cases: https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Sorry, but it strikes me that the people arguing against Rust are C++ die-hards are married so strongly to status-quo that they couldn't possibly imagine a better future. Which is of course no different than die-hards in other languages.

Re: I think C++ is still a desirable coding platform compared to Rust

#57

Yeah, that's a no from me. I'm a full time C++ dev and every time I code in Rust it is harder for me to switch back. The author has pointed to some issues regarding performance. In the end, you can always rewrite your code to generate other/better assembly, if you really need the speed. I would argue Rust is so much more that just Rust itself. Like many others after noted, it is not only the language, but the whole e…

rustup target add wasm32-unknown-unknown cargo build --target wasm32-unknown-unknown rustup target add x86_64-unknown-linux-musl cargo build --target x86_64-unknown-linux-musl rustup target add x86_64-pc-windows-gnu cargo build --target x86_64-pc-windows-gnu Boom, killer feature right there.

Well, sometimes. God help you if your project needs to use TLS, for instance.

Re: I think C++ is still a desirable coding platform compared to Rust

#58
post #50

Earlier quoted context omitted.

1. About 15 years of experience in C++, 2-3 years in Rust. 2. I'm retired now, but I would have considered Rust for any greenfield project that didn't have a compelling reason to pick C++ (e.g. mandatory interop with an existing big C++ library). 3. Rust nearly every time. I sometimes use a layer of C++ as an FFI shim, such as when writing a gRPC client/server (the Rust libs there aren't mature). 4. The library ecosy…

somewhat OT, but what happened to haskell? a few years ago it was all over HN - now you hardly see any mention of it. surely this won't happen to rust?

As far as I remember, most of the pillars of Haskell were hired to work on projects that were, at some level, competing with Haskell (by Microsoft, Facebook, Epic).

Re: I think C++ is still a desirable coding platform compared to Rust

#59

Earlier quoted context omitted.

1. About 15 years of experience in C++, 2-3 years in Rust. 2. I'm retired now, but I would have considered Rust for any greenfield project that didn't have a compelling reason to pick C++ (e.g. mandatory interop with an existing big C++ library). 3. Rust nearly every time. I sometimes use a layer of C++ as an FFI shim, such as when writing a gRPC client/server (the Rust libs there aren't mature). 4. The library ecosy…

Your thoughts about crates.io mirrors mine exactly. I'm becoming more and more interested in just ditching it entirely and using vendored checked-in (or submoduled) dependencies and managing the transitive dependency tree myself. Cargo&crates.io seems to have been inspired too much by npm. Lots of half-baked, abandoned libs that wantonly pull-in piles of other 3rd party deps and create a sprawling graph of dependenci…

FWIW, that's what Mozilla is doing.

Re: I think C++ is still a desirable coding platform compared to Rust

#60
post #50

Earlier quoted context omitted.

1. About 15 years of experience in C++, 2-3 years in Rust. 2. I'm retired now, but I would have considered Rust for any greenfield project that didn't have a compelling reason to pick C++ (e.g. mandatory interop with an existing big C++ library). 3. Rust nearly every time. I sometimes use a layer of C++ as an FFI shim, such as when writing a gRPC client/server (the Rust libs there aren't mature). 4. The library ecosy…

somewhat OT, but what happened to haskell? a few years ago it was all over HN - now you hardly see any mention of it. surely this won't happen to rust?

Entirely different snack bracket. Haskell is great stuff, but not something you'll be able to practically staff a team and build with.

Rust is not nearly so "brainy." It's a much more pragmatic and conservative language.

And it's targeted in an entirely different domain -- systems programming. Haskell is a garbage collected pure functional programming language. Rust is not anything like that.

Post reply on HN