DEV Community

Discussion on: Rust, inspire me please!

Collapse
 
dubyabrian profile image
W. Brian Gourlie • Edited

It's important that you evaluate a programming language from the proper context. I've seen a lot of comments on social media to the effect of "If you like node/ruby/python, you should check out rust!"

I think this is the wrong way to approach the language. If you traditionally work on projects where these dynamic, garbage-collected languages meet your needs, you generally wouldn't consider a language like rust as a meaningful alternative, the same way you wouldn't consider C++ a meaningful alternative. With that said, if the intention is to learn, nothing should stop you!

The most meaningful difference between rust and node/ruby/python is the use of a garbage collector. Garbage collectors are awesome because you don't have to worry about allocating and freeing memory, which makes development both much faster and safer than say, languages like C or C++.

Rust doesn't have a garbage collector. Or, perhaps, you could think of rust as having a static garbage collector: The compiler enforces certain rules that guarantee things will be properly allocated and freed. It's these rules that trip most rust newbies up—Things that would be trivial in familiar languages are all the sudden hours-long battles with the compiler because of rules that seem completely foreign at first.

When you compare how difficult it is to write a production-ready web application in rust vs a garbage-collected language, one typically walks away thinking, "That was way harder in rust and I don't notice much (if any) improvement in how my application operates!"

Again, that's not to say it isn't a useful exercise! It just may not inspire you to do more with rust. That's because you're not really leveraging rust in a way that truly distinguishes it from languages you're used to.

If you want rust to inspire you, here's my advice: Write a simple application in rust, similar to something you've already done in node. Don't expect it to be easier or even necessarily better. Once you start to feel a little more confident, go do something that you couldn't do in node!

Explore a domain where node doesn't satisfy the requirements. Where you need the speed and memory safety of rust, while having a compiler that guides you in writing fast, safe code.

Collapse
 
tunaxor profile image
Angel Daniel Munoz Gonzalez

I get you, I do. I'm not looking to replace node with rust at all I just want an alternative to do stuff as you mention that I wouldn't normally try on node, the inspiration thingy comes on the fact that I feel I'm too much into the web wagon (and I feel that it hinders me in the long run) and I don't know much about what I should do besides web