Live data from Hacker News

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

lucisqr.substack.com

61–70 of 110 posts

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

#61
This article reads like nonsense to me, but the last point of security is just blatantly ignoring facts.

> Are we talking about safety against hackers? The large majority of C++ applications are non-public facing.

Total nonsense. Even a PHP application will be running behind various webservers written in C/C++, the runtime is written in C, and there are plugins/libraries like libcurl also written in C/C++.

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

#62
post #59

Earlier quoted context omitted.

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.

I suspect Google is, too (Bazel).

If CLion/RustRover support was there, I'd probably switch my personal project over to Bazel+vendored deps.

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

#63
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?

Purely my opinion:

There was an era of stability in the Haskell project during which it was possible to write code for industrial purposes. A lot of people were attracted to the idea of a memory-safe language that compiled to native binaries, and there wasn't much competition in that area at the time.

Then the research-oriented nature of the language and community re-asserted itself with Haskell 2010, and there was a lot of churn in both the base libraries and Hackage. Around this time was when Swift, Go, and Rust had their first releases, all of which offered memory safety and varying levels of ML/Haskell inspiration. So Haskell was suddenly less appealing, and there were other options -- why file another perf-regression GHC ticket into the void when Go has an HTTP server built right into the stdlib?

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

#64
post #46

Earlier quoted context omitted.

I'd wager that any highly qualified C++ engineer worth working with can pick up Rust and become a highly qualified Rust engineer in And honestly, I'd rather work with those people than with people who came to Rust from languages like Python, Java, TypeScript, etc.

Yeah, I've seen C++ engineers pick up Rust in a few weeks. And one JavaScript engineer, too, defying my prejudice :)

I picked up Rust in a few days/weeks, but ... I'd say not totally idiomatically. It actually takes a while to really learn the ins-and-outs of the right way to express certain patterns.

If the codebase that the eng is being brought into is established with good conventions, I could see it happening quickly though.

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

#65
post #4

I agree. I'm using it both in the game server, the client and for scripting! So far I haven't really had any serious problems that would be related to unsafety. You just have to be disciplined. Source: https://medium.com/@fwsgonzo/using-c-as-a-scripting-language... I do see that peoples experience with C++ varies wildly, because shops either don't understand why modern C++ exists or they don't care. Either way, predi…

That's a lot of boilerplate code, scaffolding and additional instrumentation. In fact, much of my experience with C++ is at Mozilla, which does all of that and more. And still needs a team dedicated to recording and investigating crashes.

That's the reason for which Mozilla (and now some of the developments at Google, Facebook, Microsoft, Amazon) has started moving to Rust a while ago.

Also, I've written it somewhere else, but I'm going to repeat it:

> which practically never crashes because of memory problems

When you have memory issues, crashes are the lucky case. The common case is random memory corruption.

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

#66
post #26

Earlier quoted context omitted.

1. Hard to count. Started as a youth on game modding, but in terms of serious projects, probably 5-7 years. 2. Rust. It's a Rust shop, and the only C++ we have is in dependencies that we wrap with Rust interfaces. 3. Rust. I've probably shaved a not-inconsiderable amount of time off my life in debugging C++ issues at both compile-time and runtime (inscrutable behaviours, memory safety, broken / unstandardized tooling…

> ADTs C++ is already a very complex beast as it is. ADTs (and pattern matching) make it concise to express many different programming things. But I'd imagine that adding it to C++ would be horrendous.

Well, they already did [0]. It's not very fun to use; something that was less miserable would probably see more use. Retrofitting them to a language isn't impossible, either; there are a few languages that have managed to do it by adapting to their ecosystem's mores, like TypeScript and Kotlin.

That beings aid, I don't disagree with your general point. C++ is already incredibly complex and impossible to understand as a single individual; I don't think that can be fixed without removing things from the language.

My gut feeling is that the future of C++ is not C++, it's cpp2 or Carbon.

[0]: https://en.cppreference.com/w/cpp/utility/variant

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

#67
post #33

Earlier quoted context omitted.

Speak for yourself: I'm not returning to the world of "discipline" (aka lost productivity) without a damn good reason to carry on existing codebases. It's just a waste of a good coder and certainly of good time.

In C++ discipline is optional. In Rust it's mandatory.

In C++ crashing with a helpful error is rare. In Rust it's rare not to get a helpful error.

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

#68

Earlier quoted context omitted.

Even brilliant developers on the Linux kernel teams and Postgres teams make memory mistakes that lead to security problems. Maybe you are at a higher level than them though.

My point is that I am acknowledging that C and C++ needs more discipline. I'm not saying we eliminated this class of bugs!

It sounds like you're working on a mature C++ codebase, so yeah, good reason to stick with that. But I'm curious whether you feel it's worth spending effort on this discipline, outside of working on a particular codebase?

I don't know C++, but being freed from making effort to avoid a class of bugs was easily enough for me to learn Rust instead (not that this was the only reason).

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

#69
post #50

Earlier quoted context omitted.

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.

  > And it's targeted in an entirely different domain -- systems programming.
  > Haskell is a garbage collected pure functional programming language.
At the time there were many people trying to make a go of doing systems programming in Haskell. I remember lots of arguments about libraries using ByteString/Text vs String in their public APIs, where the research people were like "linked list of u32 is so conceptually pure!" and the systems people were like "what, no".

You can see the Haskell influence in Rust today, for example the popular benchmarking library https://crates.io/crates/criterion> is directly inspired by https://hackage.haskell.org/package/criterion>. I've seen a lot of the same names in the Git logs and chat rooms.

In retrospect, starting with a low-level systems language and adding safety turned out to be a better idea than using `ST a` to implement borrow-checking in a high-level GC'd hosted language. I can only say "it seemed like a good idea at the time...".

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

#70

all my new projects are in c17 and c++20,no rust for me. I agree they need a build system like cargo, though cmake kind of works for me. with carbon and cppfront in the works,c++ will keep evolving

I actually think Cargo & crates.io are the weakest and shittiest part of Rust right now. They're a bit amateur. But yes, CMake is something I do not miss. Though I miss the alternatives even less. Though C++ with Bazel is actually quite attractive.

So having one easy to use build system (and actual package manager) is worse than having countless arcane build systems?
Post reply on HN