But you should still try it
Rust is a Siren to some, a poison to others, and a way to hide that they are a furry to a select few (specifically thePrimeagen). I actually think Rust is a pretty amazing language, sometimes syntactically verbose but not outright the worst thing in the world. I do have lots of personal gripes with the language at times but none that actually would deter me from telling others to check it out if they want. So let us start easy and light…
What even is Rust?
Rust is a high level language like C that provides lots of guard rails to stop you from doing dumb and bad stuff with memory, aka memory safety.
Of course it’s nothing like C since C is simple and Rust has multiple ways to have you spend hours writing code that equals to nothing in runtime.
I believe theprimeagen calls this “type masturbation” which is a very fitting name. The point of Rust is actually stopping you from doing memory unsafe stuff by using something they call a “borrow checker” which apparently many people seem to struggle to understand.Skill issue.
What the borrow checker does is check the movement of the ownership of a thing while also keeping tabs on who “borrows” said thing in what manner. It’s really good at helping you make sure that you don’t do something like use after free, incorrectly give a pointer to a thing that lives too short, and making it a bit more annoying to write a double linked list.
Rust Hype Made No Sense To Me
I’m not sure what it is but I swear some people call Rust the language brought to us by God himself to save us from writing bad code. Of course anyone worth their salt in this space should know, that the true language given to us by God is Holy C, and that’s not saving us. I’m honestly amazed as well with how Rust really sold itself with the slogan, “if it compiles it works” which, as far as I know, used to be a bad joke told by system programmers who believed they mastered humor but don’t quote me on that, I’m a dumb zoomer afterall.
I did not actually give Rust a try while the entire hype was at its peak. I tried it some time after everything cooled down a bit. I just never felt really compelled about it. I mean the premise is awesome, “write memory safe code in a quick, readable and simple fashion”. I really do question at this point where did I see it, and what the person who said this was smoking cause Rust is hits none of these for me. Rust is like a brit with a shiv that you can not quite tell if he’s having a bad day or that’s just how he is. He may stab you or he may not, you have to go and try your luck to know the outcome. I can assure I got stabbed. I’m currently thinking that maybe there’s some Stockholm producing thing on that blade cause people keep getting stabbed and coming back. Worse they come back and try to get more people stabbed. Like how are you trying to convince me this is not a cult???
Rust Type System Is Expresive
The type system in Rust is very expressive and extensive. I really like algebraic types. I hate being forced to write them for everything though.
Sometimes I just need a void*
and get on with my code. Ok, maybe not the greatest of points against it but Rust does make it harder for general
concept explorations in some cases. Reason being that you have a type system that requests from you that you write at least 55% of your intent into it
when really working on stuff, sometimes it will ask for your lifetime. I hate writing Rust lifetimes. If I hit them I want to rewrite everything to
somehow work without them but sometimes that’s not an option. The cases where it is an option you haven’t written code, you have just written a bunch
of types, great job. I haven’t written such types but I have seen horrors written Rust, and the worst part is I understood half. Rust is painful at
times demanding that you tell it how your firstborn child will be sacrificed for appeasing its whims.
I do want to end this section with saying that sometimes I really like using Rust’s type system when I’m not writing the types myself. Rust crate authors are a blessing on this Earth and you should appreciate them. They move mountains for you to be able to do simple stuff like using Futures without you losing your last 2 screws.
Rust STD is Ok
I never imagined that I could share a bed with Rust, and I still don’t and won’t (Flip zoom in). With that out of the way, uhhh… The Rust standard library is not amazing in modern terms but it’s not completely terrible. I mean having to pull in a separate dependency for using async/await is not something I’d expect but the most basics of things seems to be there. Maybe it’s just that I’ve not written production code and all my projects are small and I’m quick to grab a dependency cause I rather not think about it as many people seem to say that this is lacking and I’ll take any good reason to bash on Rust.
- Where’s my full HTTP server?
- Why must I yell “TOKIO” to get async working?
- Why do I need to call old man Serde for a simple serialize and deserialize?
- Why is my waifu not real?
Though really, the standard library is enough for real simple tools which is what I primarily use Rust for personally so I don’t really have issues with it.
Why should you try it?
Now if you’ve been following along, and I didn’t lose you, you understand I’m not a fan of Rust, but that begs the question to why I think you should try it out. It’s actually a decent language despite me not liking it that much. Cargo makes a lot of stuff easy, though I don’t usually use it as I made a wrapper for rustc for my small tools that I use personally (kinoko, it’s not great but it’s simpler).
Rust once you get the general idea is not that hard to comprehend how to work with. It’s not a simple but that also helps you see things from a different abstraction layer. Coding today is just picking the abstraction layer you prefer it seems. C is unsafe, Rust is a pain, Zig is peculiar, C3 is my favorite of these, and JavaScript is there being the weird distant cousin. If you write either JS or C or Python or Zig or OCaml or Brazil (Lua mentioned), then I absolutely think you should give it a try. It is not perfect, it is not God’s gift to humanity, it is not simple, it is not quickest thing to build sometimes (cries in 1hr build), but it surely is great for your mind to think in a slightly different way. I am not saying you should stick with it long but write maybe like 3 to 5 small side projects or one big side project and then decide if you will continue to use it. I feel stuck with this cause it is very much the easiest way to write the small tools or scripts I run on my machine sometimes. Could I use something else like Go or bash or JavaScript? Yes, yes I could, but as far as I can see both are downgrades to my current experience for me. Don’t assume what you don’t know and always expect the unexpected, sausage. Also I haven’t tried out Go, I’m as of writing this trying out C3.
Conclusion
Go write some Rust, hate it and then come back once the programming socks match the carpets, wrong post. The conclusion is that I hate Rust but it does some stuff that I like and it’s convenient sometimes so I use it. I don’t think that Rust is anyone’s savior and you should never trust code just because it compiles. You should try Rust because it is an experience that may or may not be painful but will be educational one way or another especially if you’ve never touched memory before. Stay healthy, stay nerdy, stay safe, hope you are well wherever and whenever you are, and praise the sun.