Live data from Hacker News

Ask HN: What is the state of C++ vs. Rust?

news.ycombinator.com

31–40 of 156 posts

Re: Ask HN: What is the state of C++ vs. Rust?

#31
post #18

Wrong place to ask the question. HN has a high proportion of people with an unusual interest in trying out programming languages and I would say the average visitor doesn't particularly like C++. From my point of view, Rust doesn't offer any benefits that would justify a switch. I would lose a lot of experience, libraries, a mature stable platform and job opportunities in exchange for more memory safety - something t…

* can I get a good job programming in this? Without moving to another country or continent.

Yes, there are many large companies which are either actively deploying Rust, or planning to. Easily found if you search.

* is my industry showing interest in it?

Yes: security, high reliability, availability and safety oriented industries. Any industry looking to get themselves out of the entrenchment of C/C++ but still needs at least one of the major reasons why it persists.

* is any industry showing interest?

I haven't found any industry, primarily focused on software development, which isn't interested. I've been actively poking around to see which way the wind is blowing. I honestly haven't come across any industry which would actively say "No we're good with C", other than those were software is an annoyance which they grudgingly have to be involved in.

Re: Ask HN: What is the state of C++ vs. Rust?

#32
post #2

Rust is promising but C++ is here to stay. If you have a legacy C++ code base, it is much easier to sell that you are just upgrading the compiler to get new language features, that you are rewriting everything from scratch. Now we'll have to see in the next few years if, for new projects, Rust is chosen over C++ wherever it was used traditionally and in which proportion.

Like all legacy code, it will not be replaced. Now if people wanted to bifurcate their codebase they can easily add Rust libraries to existing C++ codebases. In my experience I find Rust to be more productive than C++ and easier to write. Obviously that's a pure opinion.

"they can easily add Rust libraries to existing C++ codebases."

Is that truly easy? I would expect all kinds of incompatibilities that would require going through a C layer (object layout, difference in virtual method calling, object ownership, etc). For example, calling a C++ function that takes a pair of iterators from Rust and returns a std::map, passing iterators pointing into a Rust hash table, is that easily done?

Re: Ask HN: What is the state of C++ vs. Rust?

#33
post #30

They are both great languages but rust is clearly the one that experts in both generally prefer. I have some friends who make some strange arguments for c++ but I continue to be interested why people don't want to make the switch. That being said LEGACY

I have just a couple of points. First, please be careful with the "experts" broad brush. Not all, and possibly not most, experts will agree on many things. Moreover, actual experts will understand that there are pros and cons that are context dependent. I would hesitate to label as "expert" anybody who categorically prefers one over the other for all cases. That's more like zealotry than expertise. Second, for my par…

Most of Rust's guarantees are provided at compile time and have no overhead, just to be clear.

Re: Ask HN: What is the state of C++ vs. Rust?

#34
post #3

This is all personal opinion so take it with a grain of salt. I think Rust could do some serious C++ competition if it could dethrone C++ from some platform or have a worthy alternative. That is I think Rust really needs a killer app/platform/problem similar to how Swift has Apple devices and DevOps now have Go. If Rust could get into a gaming platform or have a really good gaming library like Unity it could have a g…

> Alternatively I think Rust could compete heavily with Go since the whole microservices space is still sort of up for grabs (or atleast is so massive that there is plenty of pie to be had). I think you're wrong about this one. Go has a ton of HTTP libraries that make it dead simple to get a web service up and running with all the features you'd expect like pattern-matching URL routing, database backends, sessions, e…

Surprisingly, it's already not that painful. I recently wrote a tiny JSON service with Iron and Diesel and it wasn't that much longer or complex compared to Go. The biggest headache was figuring out how Diesel works, and it would have been a lot easier using raw queries with something like rust-postgres (which would be the way to go in Go or Node). Once the ecosystem matures a little bit more I don't see why Rust would be a bad choice.

Re: Ask HN: What is the state of C++ vs. Rust?

#35
post #31
post #18

Wrong place to ask the question. HN has a high proportion of people with an unusual interest in trying out programming languages and I would say the average visitor doesn't particularly like C++. From my point of view, Rust doesn't offer any benefits that would justify a switch. I would lose a lot of experience, libraries, a mature stable platform and job opportunities in exchange for more memory safety - something t…

* can I get a good job programming in this? Without moving to another country or continent. Yes, there are many large companies which are either actively deploying Rust, or planning to. Easily found if you search. * is my industry showing interest in it? Yes: security, high reliability, availability and safety oriented industries. Any industry looking to get themselves out of the entrenchment of C/C++ but still needs…

Downvoted because no references to back up anything you are saying. I also tried doing a quick search on stackoverflow jobs and only got back 5 results [1].

[1] http://stackoverflow.com/jobs?sort=i&searchTerm=rust

Re: Ask HN: What is the state of C++ vs. Rust?

#36
post #18

Wrong place to ask the question. HN has a high proportion of people with an unusual interest in trying out programming languages and I would say the average visitor doesn't particularly like C++. From my point of view, Rust doesn't offer any benefits that would justify a switch. I would lose a lot of experience, libraries, a mature stable platform and job opportunities in exchange for more memory safety - something t…

Sorry but that's bullshit. C++ is just a dinosaur plagued with issues inherited by design decisions made before most of people here were born. Trying to replace it has nothing to do with looking for a perfect language.

Rust could have absolutely 0 memory safety features over C++ and it would still be a massive improvement over the mess that is C++ package management and build systems with Cargo. Same is true for many other features. It's not quite there yet in terms of maturity and adoption but there's significant momentum and interest from big players that learning it now will likely put you in demand in a few years.

Re: Ask HN: What is the state of C++ vs. Rust?

#37
post #3

This is all personal opinion so take it with a grain of salt. I think Rust could do some serious C++ competition if it could dethrone C++ from some platform or have a worthy alternative. That is I think Rust really needs a killer app/platform/problem similar to how Swift has Apple devices and DevOps now have Go. If Rust could get into a gaming platform or have a really good gaming library like Unity it could have a g…

For those not aware of it, Tokio https://github.com/tokio-rs/tokio is a platform that is being built on top of Rust Futures for building exactly these types of services. It's built around futures and mio, so Tokio services are async, and elegant.

I'd say if you want to build web-backend type services in Rust right now, you'd do alright. Hyper, mio, diesel, etc. are all pretty good. I do think (and hope) that things will be much more compelling in a year once tokio and its library ecosystem have matured. Tokio's abstractions seem very compelling.

Re: Ask HN: What is the state of C++ vs. Rust?

#38

Long time C++ dev here(~15 years) currently loving Rust. Someone can probably put together a more eloquent comment however here's my top marks. 1. No memory corruptions/null pointers. Legit holds up to the promises here. 2. The path of least resistance is single-ownership which is far and away the best way I've seen to structure C/C++ applications. 3. Cargo: Pure awesome. Simply one of the best dependency management/…

I've only used Rust lightly, but can someone explain what Cargo does differently from pip-tools?

As far as I can tell, you have two files in both systems: One with the dependencies you'd ideally like to use, and one with the ones you actually used (and tested with). That way, you can update when convenient, but people who get your software have an exact known good environment.

What makes Cargo that much better than pip-tools?

Re: Ask HN: What is the state of C++ vs. Rust?

#39
post #3

This is all personal opinion so take it with a grain of salt. I think Rust could do some serious C++ competition if it could dethrone C++ from some platform or have a worthy alternative. That is I think Rust really needs a killer app/platform/problem similar to how Swift has Apple devices and DevOps now have Go. If Rust could get into a gaming platform or have a really good gaming library like Unity it could have a g…

> Alternatively I think Rust could compete heavily with Go since the whole microservices space is still sort of up for grabs (or atleast is so massive that there is plenty of pie to be had). I think you're wrong about this one. Go has a ton of HTTP libraries that make it dead simple to get a web service up and running with all the features you'd expect like pattern-matching URL routing, database backends, sessions, e…

> Building something in Rust would be much more painful.

Go may have more of those things and it may be easier to find copy-pastable examples for them, but rust has them too, and its not painfull. The things you mentioned are there and are working fine.

Re: Ask HN: What is the state of C++ vs. Rust?

#40
post #18

Wrong place to ask the question. HN has a high proportion of people with an unusual interest in trying out programming languages and I would say the average visitor doesn't particularly like C++. From my point of view, Rust doesn't offer any benefits that would justify a switch. I would lose a lot of experience, libraries, a mature stable platform and job opportunities in exchange for more memory safety - something t…

Whatever happened to learning something to broaden your view? I doubt I'll get a job in Clojure anytime soon - but learning it has been the biggest eye opener to me as a programmer in the last 5 years.

> The answer to all these questions seems to be "no".

In conclusion you shouldn't be learning it and good luck to the company trying to hire people for Rust positions?

You're saying you should only learn what the industry is pushing towards. The thing is that the industry is pushing towards what sort of talent they can acquire - this is a vicious cycle.

Post reply on HN