this post was submitted on 01 Sep 2023
98 points (100.0% liked)
Programming
17326 readers
233 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
These are the highlights of rust - regexes (the regex library that powers ripgrep), serialization/deserialization (serde, nom, pest, capnproto, etc), data manipulation (too many. perhaps apache arrow deserves a mention), etc. The language is designed for this sort of stuff.
I'm in the same boat as you. I use python to manage an LXD cluster. I didn't choose Rust because Python has an API binding, but Rust didn't. It wouldn't have been too hard, considering that the API is mostly just JSON.
Unfortunately no! (in my personal experience). I have been using Rust for a decade (since before 1.0) and am more or less comfortable with it. I no longer fight with the compiler as most beginners do. Still, the compiler complains a lot and you have to think about why. This is not bad, IMO - all that thinking make you design better programs. There is always a sweet satisfaction of writing excellent code when you finish a Rust program - probably the reason why Rust developers love it so much. But you have to sacrifice some speed for that.
Intuitiveness is also subjective. My introduction to programming and computers was from the hardware side - from ALUs, DRAM, hardware pipelining etc. Rust's rules are very well defined, but is obscurely related to real problems you encounter in the hardware. In other words, Rust rules look confusing at first, but it makes sense once you see the error messages. You know what problem could have happened on the hardware if Rust didn't stop you. It's as if Rust's simple rules magically cover the problems you dread on the hardware.
All this means that Rust is easy to grasp for people who are already using C - OS, game engine, web engine and embedded system developers. For others who are mostly used to GC languages, it's an uphill battle with the compiler, until some day it clicks somehow. With Rust, it's very important to start right away with the (c lang) memory model and Rust's aliasing rules.
I wouldn't say no to learning a new language. But I always recommend a few languages because they introduce a radically different idea. Rust is one of them. My rant above probably gave you an idea why I would recommend Rust. The first is that Rust forces you to design programs properly - even though the rules are meant only to enforce memory safety. Second is that Rust gets you very close to the soul of the hardware. Python and even Go has some opaque layers in between you and the hardware. With Rust, you'll get every opportunity to get the best the hardware can offer. You get the same in C and C++ - but they also allow you to screw up.
I use Rust for even trivial tasks where a shell script would suffice. Besides the language features, Rust has excellent tooling and a rapidly growing library ecosystem. In many ways, it's easier to package Rust programs than Python ones. So Rust will work for your use case. But if development speed is more important to you than performance, then Go (similar to Python), Nim (much more similar to Python) and Zig are probably better choices. Repeating something here - Go is designed for the web. Numerous web backends are already on Go. And almost the entirety of Kubernetes is written in Go.
Thank you, great response. Based on your opinion and another, I believe I will focus on learning Go. I mostly need the benefits of compiled languages in order to easily distribute, as well as easier parallelism, as I've always found that to be a pain in the ass with Python. Not sure if Threading, Concurrency, or Asyncio are the "best" way to handle threading of non CPU intensive tasks, such as sending a request and waiting for a response. But I know that it seems since Python has taken so long to attempt to allow easier bypassing of the GIL, you get a lot of decent ways of doing something, but no great ways.