Why Rust is the most admired language among developers?
Why Rust is the most admired language among developers?

Why Rust is the most admired language among developers

Why Rust is the most admired language among developers?
Why Rust is the most admired language among developers
Easy. If my editor shows no errors anymore, it will run, instead of crash due to my ignorance of alignment, leaks, etc.
I'm just a lazy developer, so blame me if you want. I just don't want to learn that stuff if I don't really really need to. I have to memorize enough already.
As someone building embedded systems, the compile (in release mode otherwise the program does not even fit) + flash + run tests with limited visibility workflow is just soooo slow, have to do so little actual debugging thanks to the type system is a godsend.
It's a cult. A vocal minority doesn't speak for an entire industry.
So the survey of 90k developers on one of the most popular programming sites, have it as the most "want to reuse it in the future" language for 8 years and this is somehow a minority?
What is your data source for this enlightened majority that is opposed to it? Your own opinion?
Generally the programmers that visit these kinds of websites, let alone participate in a survey, are the enthusiast programmers who are much more likely to be interested in exploring a new language in the first place.
There's a considerable potential for a selection bias here. Not that this disproves the survey, but generally these kinds of surveys tend to be a little bit ahead of the curve, so to speak.
Watch out: That mindset is what got me into Rust in the first place!
I was so fed up with everybody drowning on about Rust that I thought I need to read up on it a bit so that I can argue against the hype. I am a seasoned C++ dev after all, I use a language that I picked because it allowed for robust and fast code. What could Rust add on top of that?
Well, I have a job working almost exclusively with rust now and do not plan to ever go back.
Working on scientific code, Rust is amazing.
We used to either code in C or Python. Now Python is only used for data analysis pre-post computation.
The code is as fast as in C, the compiler is great at helping us prototype without bugs, memory usage is lower.
We dropped C complelty and reducing our usage of Python.
Coding is and always has been fad driven. The article admits Python and so on are more popular.
Yes, but all programmers have a love/hate relationship to their languages and toolchains. When I started off back in the 90:s, my prefereed language was Perl, it was amazing, but it was also a nightmare in some aspects... and unfortunately the larger the project the larger the nightmares. I assume Python is probably pretty much the same, even though I have avoided to work with dynamic languages in very large scale projects due to the support nightmares that comes with them. So I assume the Rust cult, is based on the fact that the rust frustration comes a lot from the strictness of the language, but that becomes less of a problem the more you use it (since your skills improve) and at that point the strictness instead gives the reward of reliability and efficiency.
So, while dynamic languages may frustrate you the more you use it (since the projects grows and it is a nightmare to maintain), rust will instead reward you over time.
The dogpiling circlejerkers don't concern me.
Because is so hot right now.
I can only speak out of my own experience, which is mostly C++, C#, C and Rust, but I also know a bit of Haskell, Java, Fortran, PHP, Visual Basic, and, to my deepest regret, also JavaScript.
For additional context: I have been working in game development for the last 7 years, my main language is C++ for Unreal, but I've also worked on some Unity projects with C# as main language. Before I switched to game dev I worked in material science, and used C, mostly. I use Rust for my spare time projects, and the game company I work at is planning to introduce it into our Unreal projects some point later this year.
Of all the languages I mentioned above, (Safe) Rust and Haskell are the only ones that have not yet made me scream at my PC, or hit my head against the desk.
So, some of the reasons why I personally love Rust:
The points mentioned above mostly apply to Safe Rust though. Unsafe Rust is a different story.
This brings us to the downsides. Rust isn't perfect. Far from it, actually. Here are some of the things that aren't great about Rust.
async
keyword in the language itself.However, the upsides clearly outweigh the downsides imho.
tl;dr If a (Safe) Rust program compiles, chances are pretty high that it also works. This makes programming with it quite enjoyable.
For downsides, i'd like to add that the lack of function overloading and default parameters can be really obnoxious and lead to [stupid ugly garbage].
A funny one i found in the standard library is in
time::Duration
.Duration::as_nanos()
returns a u128,Duration::from_nanos()
only accepts a u64. That means you need to explicitly downcast and possibly lose data to make a Duration after any transformations you did.They cant change
from_nanos()
to accept u128 instead because that's breaking since type casting upwards has to be explicit too (for some reason). The only solution then is to make afrom_nanos_u128()
which is both ugly, and leaves the 64 bit variant hanging there like a vestigial limb.Ah yes, the Chaos Theory principal of programming.
You've settled my mind on which language to tackle next. There are a couple projects that have been calling my name, one in Go and one in Rust. Strictly speaking, I might be able to contribute to their documentation and tutorials without ever looking at the code (nobody in their right mind would ever accept code from me anyway), but I like to have some idea of what goes on under the hood.
Rust it is.
I can relate. And thanks for this high-effort comment.
I've been writing C++ for years and I have yet to be burned by undefined behavor. And because it exists the compiler doesn't have to insert some slow if checks for places my code could do different things on different systems.
I run undefined behavior sanitizer on everything. The only time it has ever complained was a case where my platform does define the behavior and I was intentionally relying on that.
The existence of undefined behaviour does not at all help performance. Those unnecessary if-checks are mostly a myth and even when they are introduced (e.g. bounds-checks when indexing arrays), they are usually outweight by the advantages of disallowing aliasing (references can be used much more "carelessly" without rutime checks, because these checks happen at compile time by default, comlilers can generally optimize code better because they know more about aliasing of specific data or the lack thereof). In larger, modern c++ projects a lot of smart pointers are used to enforce similar aliasing rules, which are then enforced at runtime though. Generally, the lack of undefined behaviour enables both programmers and compilers to design, architect and optimize code better. There are enough examples out there. Cloudflares in-house proxy solution comes to mind, which is written in rust and easily beats nginx (!!), serving billions of requests per day.
If by platform you mean target CPU you should be aware that it's still undefined behaviour and that it could break optimizations, unless your compiler also makes a commitment to define that behavior that is stronger than what the standard requires.
Note though that it's perfectly fine to have multiple mutable raw pointers pointing to the same data, as long as thereβs no ownership held by any Rust code. The problem only happens if you try to convert them into references.
It seems I misunderstood something important here. I'd take that as proof that Unsafe Rust is rarely needed. π A quick test on the Playground shows that indeed, using raw pointers does not yield the wrong result, while using references does: https://play.rust-lang.org/?version=stable&mode=release&edition=2021&gist=96f80d43d71a73018f23705d74b7e21d
Conclusion: Unsafe Rust is not as difficult as I thought.
Where do you work if I may ask? Every game company I worked at was pretty much set in their ways and I'd love to have an excuse to use rust professionally!
Before you get overly excited, we plan to introduce it later this year. As in game-dev "plan", as in "it might be cut or delayed" π. What is holding us back is that we need time to get a Rust toolchain set up for all our target platforms, which have certain requirements that the toolchain needs to meet, and time is always a tight resource in game dev.
That said: Our technical director is very adamant at pushing us towards a more functional programming style (his website explains why). If we could, we would go pure functional right now, but it's really hard to find people who have experience with fully functional languages, and therefore we want to have the next-best thing, which is Rust. (Or F# for Unity projects. We don't have any Unity projects right now, but we already have used F# in Rescue HQ, for instance.)
And finally, to answer your questions: I work at stillalive studios. Here is a list of our open positions: https://stillalive.games/careers/ Also I can say from personal experience, that the "speculative application" paragraph is definitely true.
As someone who likes Rust and uses it every day, how have you never screamed at your PC as a direct result of the borrow checker or trait solver? Have you never encountered errors such as
higher-ranked lifetime error: failed to prove $FOO: Send
, which is sometimes actually just a bug in the compiler? Or the classicthe trait bound $FOO: $BAR is not satisfied
.axum
even has a#[debug_handler]
macro just to improve this error. I have spent literal days of my life fixing these kinds of errors, when the compiler not only doesn't provide a solution but fails to pinpoint the cause of the problem.I can only hope diagnostics continue to improve, because I know they matter to the Rust team.
I have seen some errors along those lines (but not exactly those) while working on the Free Monads proof of concept. Especially while trying to come up with a solution that doesn't require macros (which I didn't manage in Stable Rust, exactly due to such issues).
I have yet to see them in actual production code though, but maybe I was just lucky up to now?
Can you explain how?
First things first: I haven't fully thought this through, as I haven't attempted to implement it (yet). It was just an idea I had while working on higher-free-macro.
It wouldn't yield the same syntax of course, but you could express the flow of the async computation in the terms of a Free Monad based embedded domain specific language. The interpreter for the eDSL in question would then do the equivalent of the async runtimes we have currently.
I could imagine that the syntax could be pretty nice when using the do-notation from higher.
However, since I haven't tried implementing it, I can't say for certain that there aren't any hard walls one could hit, especially related to Rust's ownership model, or more complex dependency trees.