by reggieband · 9y ago · 0 comments
I get the same feeling on Hacker News about Rust. There is a point where well-meaning evangelism does more harm than good. I sometimes get the feeling people spend more time writing defences of these languages than they spend time writing programs in them.
It sounds and seems like a language worthy of more investigation on my part, but I have to agree that the militant, presumptive attacks on any language besides their Chosen One has left a bad taste in my mouth.
I don't think anyone is arguing that we should throw everything out, however for all my greenfield stuff Rust has been a welcome breath of fresh air. Yeah, there are some people who are a little too over the top but a large part of the support behind Rust is from those of us who've used it in production and found it to be a fantastic language and ecosystem.
If you can write things from scratch in a clear room fashion, perhaps.
C++ is very good, when you need to integrate a lot of 'low-level' libraries (that are alredy in C or C++) together in a meaninful way, like for instance, browsers do.
Like the capacity to 'talk' with FFMPEG, levelDB, linux, etc.. in a complete native fashion basically.
I think in that regard Rust is sort of late to the party, and will find a wall hard to beat down, once the adoption rate get some maturity.
If you are already a experienced C++ dev, compared to modern C++, Rust has very little to offer. Of course is more modern, (maybe) more ergonomic?
But little things like package manager or explicit lifetime management by itself wont cut it.. at least not for people with large codebases already in C++.
When you are younger, programming languages look like that secret ingredient that will turn whatever you do into a magical tool.. But experience tells you that nothing beats hard work or that you should understand the strenght and weakness of each language, and know when and how to use it.
So for the problem domains where C++ are being used, it will get hard to beat, because a lot of great software are already there, and can be integrated in a native fashion, with whatever you do on top of it.
And by the way, modern C++ is already secure enough, making some selling points for Rust, a little bit of cosmetic right now.
If you throw a language like Swift into the equation.. particularly i think they(C++ and Swift) form a lovely and unbeatable couple.
The reason I ask is just about every item you laid out I've had the opposite experience.
Talking with C/C++ is trivial with bindgen and clang. Embedding in C++ is likewise straightforward. I mean Firefox is one of the larger C++ codebases out there. The package manager is great and makes dropping in things much less painful.
On the security front I don't think you can compare the two, I can easily think of things like iterator invalidation that C++ just doesn't handle well.
The last big project I did in Rust ran on 6 different targets(x68 win32/linux/osx, android armv7/x86, wasm) targeting 3 different rendering stacks(OpenGL, HTML Canvas, Android Views) integrated deeply with a Lua interpreter. Having done cross-platform stuff like this in the past it was a build/toolchain nightmare. With Rust everything was straightforward and pretty darn painless.
There is not a single large-scale network-facing widely attacked piece of software I'm aware of in C++ that has not fallen to some memory safety problem. Memory safety issues frequently produce RCE.
Why to have nullptr dereferencing? Why to have an undefined behavior on option<> dereferencing? Why to have dangling refs? Why not to check borrow possibility statically? God, we don't event have a decent and safe variant (sum) type in c++. Adding all that (unnecessary) complexity c++ has (how many whatever-values and initializations does it have?). It is unsafe as hell, and lots of stuff could be made safer trivially in a new language (say, rust or F*).
That's sorta funny that you use that example, since rust is a Mozilla project, and they've already moved some parts of Firefox over to rust, and plan to move more in the future. Clearly this is not an impediment; reasonable C/C++ interop was a must-have for rust's design.
> If you are already a experienced C++ dev, compared to modern C++, Rust has very little to offer.
That's a weird argument to make. Essentially you're arguing that you should never learn any new languages once you have proficiency in something similar? That would seem to be a bit short sighted.
> ... at least not for people with large codebases already in C++.
Sure. No one's saying "throw out all your C++ code and rewrite everything in rust" (and if anyone is, they can be safely ignored). But that doesn't preclude taking a look at some parts of your code that might benefit from being written in a safer language, or rewriting small tools in rust, or considering it for new projects.
> When you are younger, programming languages look like that secret ingredient that will turn whatever you do into a magical tool.. But experience tells you that nothing beats hard work or that you should understand the strenght and weakness of each language, and know when and how to use it.
No one's saying languages are magic, just that, by some metrics, some are objectively better. This might be an odd example, but I did Java for many years before switching to Scala a couple years ago. In the past few months I've had to go back to Java, and it's been frustrating that it's so easy to write certain classes of bugs that I just never see or write in Scala. Does that make Scala some magical tool that fixes all my problems and means I don't have to do any work? No, of course not. But it is objectively better than Java by some metrics (and sadly, worse by others).
> modern C++ is already secure enough
That's a pretty bold claim, and I'm certain it's not true. You might have a different idea of what "enough" is than I do, though. I'd believe that the "default" state-of-the-art C++ use is more secure than it was 10 years ago, but that doesn't mean that a language like rust can't offer superior safety guarantees.
And there's something to be said about encouraging safer practices through language features and convention. If you can make certain kinds of errors in C++ programs (I don't see pointer arithmetic going away any time soon, or people always using vectors and the like and never raw arrays), then you (or someone else) will, regardless if there are safer ways that help you avoid those kinds of errors. Given a language with a huge surface area like C++, and disagreements on what are the "safe" parts to use, it's inevitable.
> If you throw a language like Swift into the equation.. particularly i think they(C++ and Swift) form a lovely and unbeatable couple.
Despite Swift's open source status, I really don't see it making any meaningful foothold outside macOS/iOS.
I don't have a horse in this race. I abandoned C++ years ago, and I've only started learning rust a few weeks ago. I like it, but I have a lot to learn, and I've already found some rough spots that aren't so great. No tool is perfect.
This 100 times over. It's a language that seems novel and strong enough to stand on its own merits - but there's a section of the community that makes me want to stay away.
I wish they'd spend less effort re-writing already working tools in C and more effort writing new, better tools. A drop in replacement for "ls" isn't that exciting for me.
And a good getting your feet wet project for someone else :)
Is this really a thing? Folks keep pointing out this bugbear of folks going out and asking projects to rewrite in Rust and ... there aren't that many examples of this.
If anything most of the more famous Rust projects (ripgrep, redox, etc) are clean-slate.
Personally, I don't find this a bad idea, as long as it is not the primary thrust. The reason it is needed is that you aren't going to convince everyone to change the default tools they've used for however many years. If you want to make things safe, you have to swap out implementations and keep same/similar interfaces.
That doesn't change the fact that Rust programs are, when memory safety is concerned, more secure than C++ programs. This is true both in theory and in practice.
Why would not knowing C++ bar people from anything? It's a wildly specific skill, diminishing in importance every day.
The game goes like this: start discussing something: say, including rust in OpenBSD.
- Assume it (here, using rust in oBSD) is a great idea.
- For each objection, explain why it is trivial. Your tools are your own reasoning and knowledge of programming, the ability to ignore, minimize or belittle any and all reasons why things are the way they are, assuming away any legacy issues, and remembering that all needs and use-cases in the world exactly match yours.
- When you get bored, just walk away. It isn't your problem, after all, and you were just trying to help. High-fiving your cohort optional.
It ends up simultaneously coming off as arrogant and clueless. Last time I had a small problem and the time to try something new, I started it in rust. After getting a series of jackass responses to a simple question[1], I wrote it in C, because I just don't care enough to put up with twits fluffing their own ego at the expense of newbies.
This problem is hardly unique to rust - unfortunately it happens everywhere nerds gather. But rust has a really bad case of it.
[1] Found the answer a few days later when I thought of a better search term.
[1] https://chat.mibbit.com/?server=irc.mozilla.org&channel=%23r...
Getting those responses where, exactly?
If you had mentioned literally any other language with a FLOSS community around it I wouldn't question that statement. However, Rust proponents so clearly claim to do the opposite-- you've even got Steve below explicitly stating that jackassery isn't allowed in Rust forums.
What's the data to the contrary?
I think I recall reading somewhere on Rust's website that telling project maintainers to switch to Rust was frowned upon, however I can't find it right now. Sometimes I feel like it should be written in a 20pt font on the home page. Or maybe written in blinking letters every time you run rustup.
I always feel it's very presumptuous and somewhat disrespectful to second guess the devs of a project, in particular if you're not a big contributor yourself. Pay your dues. These messages are effectively not a whole lot more useful or insightful than saying "Rust rulez, C droolz" or "have you considered indenting with spaces instead of tabs?".
At the same time, I don't see it actually happening as much as people say that it happens. Maybe I just don't see those things. If I did, I'd tell them to cut it out.
Language advocacy is far older than Rust. And many language advocates are far more obnoxious than what I read on HN with regard to Rust. I actually have the feeling that the C++ crowd is just a bit sad that the usual defense of "well, yeah, other languages do those things better, but the code they produce is far too slow for our problem, so they're useless!" doesn't cut it anymore.
Java is a great language in theory, the problem with Java is that people have evolved to use layers upon layers upon even more layers of abstractions, the tooling is horrenduos (try configuring maven vs npm) and especially all complex Java applications end up being as slow as molasses (e.g. SAP GUI, Lotus Notes, Eclipse, jDownloader, Vuze on the GUI application side).
This leads to people projecting their horrible experiences with the Java ecosystem and applications to the language itself, which is a pity.
vs Cargo (Rust) - http://doc.crates.io/build-script.html (simplicity)
vs elm-package (Elm) - https://github.com/elm-lang/elm-package (automatic semver compliance)
vs Stack (Haskell) - https://docs.haskellstack.org/en/stable/GUIDE/ with stackage-sets (packages tested to work well together) - https://www.stackage.org/
That's kind of a weird comparison since npm is a package manager and maven is a build tool, packager, dependency resolver, test runner, ...
A better (but still lacking) comparison would be "try configuring maven vs. npm+webpack", and then I'd say... oh god, I'll take maven in a heartbeat.
Also there are lots of similar architectures in the .NET world with WCF, Web Forms, EF, SharePoint, ...
Anyone that thinks JEE is bad, should spend some weeks trying to do the same with CORBA, DCOM or SOM, in either C or C++.
Same thing will happen to Go, JavaScript, Scala, or whatever language gets adopted into the enterprise cathedral.
The reaction of some parts of the Java community to Hypertable choosing C++ instead of Java was nothing short of embarrassing for instance, but it's not just that, over the years I have seen too many examples to list :)
IME a lot of thin skinned people on the internet always view the former as the latter. It's equally as tiresome.
Pure fanboyism. Better than C yes, but not better and much slower and unsafer than ATS or Pony.
You nearly made me spray coffee all over my precious Microsoft Natural Ergonomic Keyboard. (Which - no joke - would have been the third I would have destroyed this way.)
Thank you for starting my day with a healthy dose of laughter! (I know that comic is trying to make a serious point, but the surreal example it chose is just so hilarious!)
Programmers love language wars.
Once your instincts adapt to something intimately (and programming languages require that); that's what feels right. You'll argue vociferously against a change and use what are objective reasons. (The Thunderbolt could dive faster, it was a brick.)
Of course, in the United States Army Air Force, you still had to switch.
The old hands usually remain convinced of the superiority of what they know, and irritated by Young Turks telling them something else, nicely or not. Because the Young Turks can't be right. But they are, often.
Programming Language Advocates love language wars
Most programmers just like to be aware of ALL the PROs and CONs of the languages and choose the right one for the task at hand.