Rust framework actix and actix-web are dead
github.com
github.com
In which case the "downside" from unsafe code is much less (it's not going to leak an entire database of people's private details to the web), so would people still make such a big fuss about removing it? Especially if removing it involves any performance compromise, which in HFT at least would be unacceptable (or at least politically unacceptable when trying to sell Rust).
If you wrote a game engine in Rust, and open-sourced it, you'd probably get similar grief. Because that's what Rust is largely about. Anyways, certain high performance render applications (browsers, ahem), don't seem to suffer significant penalties.
Also, I'd argue that memory safety/rce protection/etc is crucial in games, particularly ones that are online. HFT running in a contained env? Less so, for sure.
It's a modern language: no #includes, faster compilation (compared to template-heavy C++), nice macros, compile-time reflection (libraries like Serde are really nice), generally nicer stdlib than C++, decent package manager. And it's one of the only languages with RAII/destructors, which to me are one of the best things about C++.
>Also, I'd argue that memory safety/rce protection/etc is crucial in games, particularly ones that are online.
This applies to the server, but not to the graphical game client running on the user's machine, as the client is usually not accepting random inbound connections, instead it just connects to the server.
>This applies to the server, but not to the graphical game client running on the user's machine, as the client is usually not accepting random inbound connections, instead it just connects to the server.
There have been a few demonstrated RCEs in game clients (especially in P2P models which many modern games use).
You should profile/benchmark that with a couple thousand lines of code... C++ can be slow to compile (although it isn't always), but so can Rust.
I will add to your list that Rust generally has nicer error messages.
However from experience I can say that you can use Rust against the grain, which will result e.g. in constant fights with the borrowchecker, weird solutions to get around the typesystem and a ton of unsafe (=trustme) blocks.
Rust can do a lot for you, you just have to think a little more about a programs architecture and don't force paradigms like OOP onto it.
Whatever you're doing, you should care about soundness. In games and HFT unsound code leads to segfaults or undefined behavior, not necessarily security issues.
There are a handful of places where safety guarantees can (in some cases) actually cause performance issues. Most common would be iterators created from nested adapters over slices of known length. But that's the kind of thing unsafe exists for and no one is going to get fussy about you using the escape hatch for the manual checks.
But most of the soundness guarantees of rust can't be avoided without a bit of effort even within unsafe blocks, and don't come with performance hits. That is because the core promise of borrow checker is that it guarantees you will not create multiple mutable aliases of the same data through your program logic (you can only really do this with manual pointer hackery, edit: or interior mutability primitives).
That's what omits things like iterator invalidation and use after move/free from being composable in the language itself, and they're things that asan and valgrind can't really catch unless you're fuzzing the crap out of your program during testing. But that's a lot of effort and developer time sitting around to make a best guess about something not happening that doesn't have performance impacts.
But really at the end of the day, soundness, memory safety, secure, these are correlated but different concepts that most programs have to deal with in one way or another.
People should be allowed to be free of harassment. I think everyone would have been better off in this case if the individuals who were so concerned about the unnecessary safety, forked Actix and had a SafeActix, that was maintained without the usage they were concerned about.
If the maintainer isn’t going to accept your patches, then it’s time to decide how to move forward without needing to resort to harassment.
I always like to translate unsafe in my head to "trust me I checked this very thoroughly" — if there are indicators that the author doesn't deserve that trust, I just won't use their stuff.
Rust can be very safe, but you should really program on all levels. Check and abstract common low level magic you need into a libray and write extensive tests for it. Then use it from a high level.
Unsafe blocks are not per se a bad thing (in fact, they are needed to solve certain things efficiently), just make sure you really know why you need it and what you do within it.
Also, the internet being the way it is, if you use unsafe correctly to do things that you could have done with safe code, where the compiler would have produced the same result either way, rude internet people will probably be rude to you.
Now to your question. Rust is a language that allows you to express correct programs in a number of contexts. Memory safety and concurrent modification free code being two chief ones. What people are constantly proving is that unsafe escape hatches for performance reasons are not as regularly required as similar C implementations would make you believe.
In games and HFT, I would argue having correct programs is as important as any other area of development. That’s the gamble, that you no longer need to make the trade off of safety vs. correctness. But, for expediency of development I could understand why folks see this as a trade off that is required, but that’s really just about the maturity of the language ecosystem in those areas.
Ideally any unsafe code will be contained inside a crate and never be exposed to users of that crate. The crate says “I’m giving you these safe APIs and if you use them, then your code will be safe”, it’s a contract. The point being, for games and HFT, there are many cases where you’re interacting with hardware to improve performance, the big question then becomes, can those hardware abstractions offer safe APIs such that any code built on top of them would be safe. I’d argue Rust proves that this is possible to do, and in answer to your ultimate question, that yes, even in these contexts, Rust would allow developers of those types of programs to build more correct software.
On the other hand, very little of the Rust community actually does HFT, or understands the trade-offs. In HFT code, "caching pointers" to just about everything is extremely common, because it's super fast. So you'd be using unsafe a ton. If people got a glimpse of some of the code, I have a strong feeling that some subset would start lecturing (unironically, engineers with a decade of experience in HFT) about safety vs perf trade-offs, and ask "have you actually benchmarked", etc.
I'm a little worried about the professional ramifications he'll face. His employer is definitely aware of him burning down all of his open source code. That's got to make for awkward conversations with his team, peers, and manager. It's also going to make future job hunting weird if that subject is broached.
How did this escalate to this point? Why couldn't people be nicer to him? Even if the unsound arguments are true, there are better ways to offer constructive criticism. People needlessly backed this man into a corner from which he saw this as the only solution. He's going to be dealing with this for some time. :(
Without knowing him, I'd worry he'd do that in other organizations he's a member of. What if he has a fight at work? Will he delete stuff or leave in a hurry without making arrangements for other maintainers?
I'm not saying he would do these things or that he's a bad person, it's just something I'd be cautious of given his response to this. If I were his manager or coworker I certainly wouldn't fire him, but I would talk to him about it.
As for next steps, I think the maintainer should undo the deletion, apologize for the rash response, thank the sane members of the community for their appreciation, and leave a message that he's disengaging for awhile (it could be forever). That would be the perfect way to go about it. It doesn't leave a bad taste, and it's an overall good look. It's the high road.
I still feel incredibly bad about how the community treated him. He was doing amazing work for all of us, and some careless folks berated him needlessly. There are better, more constructive forms of criticism.
It would be like building a GraphQL framework that serialized all data as Base64'd XML inside a single field, or perhaps if the biggest Burning Man art car was police-themed.
Good call, fafhrd91! C'mon, people, it's only software, try to understand each other and be civil.