Rust is the most loved language of developerssteemCreated with Sketch.

in programming •  6 years ago  (edited)

And here's why…

1_sP-6NZVTsJrYVJUazpe_iA.jpeg
Screen Shot 2018-06-15 at 9.56.16 PM.png

Rust, a new systems programming language from Mozilla is becoming increasingly popular because it runs blazingly fast, prevents segfaults, and guarantees thread safety. Interesting, isn't it?


1_NKiI9yr8GhqFS1gH6nu7Yg.png


If you've written C/C++, you should know it's easier to get segmentation faults with those programming languages. Although they give developers more control over assembly generated, they aren't safe by default.


1_JtiPpT-FMMz8xgOkj0gZSA.png


On the other spectrum, we have languages like Haskell where the developer has very little control over what's going on. But, they're very safe. You can still get exceptions but they're pretty contained.

That's why Rust is popular.

Rust is safe by default; all memory accesses are checked so it's not possible to corrupt memory by accident. It gives the developer all the safety and the control, while at the same time providing speed and concurrency.

The unifying principles behind Rust are:

  • strictly enforcing safe borrowing of data
  • functions, methods and closures to operate on data
  • tuples, structs and enums to aggregate data
  • pattern matching to select and destructure data
  • traits to define behaviour on data

Screen Shot 2018-06-04 at 5.53.45 PM.png

According to the 2018 Stack Overflow developer survey, Rust was the "Most Loved" programming language for the third year in a row and in the top ten of "Most Wanted" languages.

Where Rust Shines

1_wkRjyzGnOHmrh1aFvQfggg.png

As a statically and strongly typed programming language, all types are known at compile-time and these types are designed to make it harder to write incorrect programs. In layman's term: if it compiles, it's safe. Yes! If it compiles, it's safe. Guarantee.

That's a huge pain relief for developers.

Rust brings confidence back, in your code, but also in the code of others you might want to reuse.

And because Rust is safe, we can tackle concurrency head-on

Here's a taste of concurrency in Rust:


1_IYy9GjhUdAVllg0wQOE9ug.jpeg

  • A channel transfers ownership of the messages sent along it, so you can send a pointer from one thread to another without fear of the threads later racing for access through that pointer. Rust's channels enforce thread isolation.

  • A lock knows what data it protects, and Rust guarantees that the data can only be accessed when the lock is held. State is never accidentally shared. "Lock data, not code" is enforced in Rust.

  • Every data type knows whether it can safely be sent between or accessed by multiple threads, and Rust enforces this safe usage; there are no data races, even for lock-free data structures. Thread safety isn't just documentation; it's law.

  • You can even share stack frames between threads, and Rust will statically ensure that the frames remain active while other threads are using them. Even the most daring forms of sharing are guaranteed safe in Rust.

These are all made possible with the trustworthy concept of ownership, borrowing, and lifetimes. Rust's code can never access data when it shouldn't. And because most checks are done at compile-time, there's no extra computation needed at runtime.

So, who's using Rust?

If you head over to Friends of Rust, you'll see many people are running Rust for production. Currently, the most widely used Ethereum client — Parity is also written in Rust because of good reasons (i.e. fast, memory and concurrency safety, small footprints).

…and because Rust is a safe, concurrent and practical language

1_ruSb9PjAx0omsZ444tOEOA.jpeg

You should definitely build blockchain with Rust!

If you aren't aware, there's a project called Tendermint, which allows almost all blockchains to interoperate and gives everyone the ability to write their own blockchain in their favourite language. Today, you can use rust-abci library to easily write blockchain apps (or anything which needs a decentralised and fault-tolerant database) in Rust.

Summary

Overall I see huge potential for Rust in the near future, especially when the era of blockchain and AI is upon us —where safety, performance or total control over the machine are essential.

With Rust, errors could finally be a thing of the past. No null pointers, no segfaults, no memory leaks, no data races. No wonder Rust is the most loved language of developers.

In that regard, let me sign off with a simple main function using Rust,

fn main() { println!("Thank you for reading!"); } 



upvotefollowresteem.gif

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by mrblueberry from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.