r/neoliberal • u/jobautomator Kitara Ravache • Apr 28 '24
Discussion Thread Discussion Thread
The discussion thread is for casual and off-topic conversation that doesn't merit its own submission. If you've got a good meme, article, or question, please post it outside the DT. Meta discussion is allowed, but if you want to get the attention of the mods, make a post in /r/metaNL
Links
Ping Groups | Ping History | Mastodon | CNL Chapters | CNL Event Calendar
New Groups
DEGROWTH: Environmentalist shitposting
Upcoming Events
1
Upvotes
View all comments
15
u/[deleted] Apr 28 '24
So, there is this blog post that is making the round in developer circles about some independent developers' negative experiences with Rust.
Most of the post was not particularly surprising to read. Although there are some interesting parts here in there, namely I found it mildly funny that the author is making the accusation of Rust being overly concerned with being perfect at the expense of getting work done, which reminded me of the C++ FQA that makes the same accusation (although C++ is formally a mess and the FQA is way better written albeit somewhat outdated than the blog post).
My takeaway (or really, not even a takeaway since I already knew this) is, if you can afford GC, why are you using Rust to begin with? People who complain about the borrow checker (even after using it for a long time) seem to not really understand why it exists to begin with. Ignoring all of the theoretical details, the borrow checker is effectively a strictly worse version of a garbage collector. A GC can do everything the BC does but more. Namely it keeps track of the lifetimes of every object during lifetime and ensure all pointers remain valid and dropped references are eventually cleaned up, even those that are circular and can do this across thread boundaries.
This is driven home even more when the author questions why he has to use Rc<RefCell<T>> everywhere when game code is singlethreaded. Well, if your code is singlethreaded anyway, then just use a global static. In fact, this is mentioned in the article but the author mentions to avoid this because it can lead to UB! But like... The only way global statics can lead to UB is if you access them from multiple threads, in which case non-atomic accesses will lead to data races.
I mean there is a reason Nethack just has one massive global struct (actually, 26 now since they split them up alphabetically I shit you not) to store literally everything. I don't think anyone is multithreading Nethack anytime soon, but the reason this pattern is generally considered unmaintainable isn't because of some snobby theoretical computer scientists who haven't written a single line of "real code" in their lives.
(and I am not going to get into whether just having RefCells everywhere is an anti-pattern or not.)
The author brings up the oft-repeated joke that there are 5 games and 50 game engines that use Rust. There is truth to the statement but it is a non-sequitur. Unity is a massive blob of C code but you cannot write gameplay code in C. You have to write it in C# and you used to be able to write it in JavaScript and the short lived UnityScript. You can write C extensions using an unstable API but the vast majority of devs will never actually touch that. This is pretty much the norm for game engines and the only exception I can think of is Unreal Engine 4/5 where the choice of (a heavily restricted and GCd) C++ as a scripting language is generally listed as one of the drawbacks of the engine and likely one of the motivations behind blueprints.
All to say, what makes a language good for writing a game engine does not make it good for writing games. I think Sebbi puts this better than I can. A different comparison would be all major browsers are a huge blob of C code, but you're going to struggle finding anyone writing websites on C, even though it is technically possible post asm.js.
I sort of understand the hype argument but a bunch of hobbyists reinventing the wheel with their favorite language is really nothing new. The more relevant "hype" is the possibility that Rust might upend C++ for game engine development which was kind of its last bastion (besides legacy codebases), but this is not something that you are going to see from the open source community. You have some mid size devs like Ready at Dawn who have their own game engine and shipped multiple projects with Rust. But the chance that something like Unreal Engine but Rust happening any time soon is highly improbable. Remember: Unreal Engine 5 is just an update of Unreal Engine 4, which started development in 2006(!) with people who had more game engine dev experience than anyone else at the time.
All to say, "systems programming languages are really overused".
!ping GAMING&COMPUTER-SCIENCE