Reasons to Explore Rust and A Brief Intro

Four years ago, I began studying Python as my first programming language. I have enjoyed it so much. I now enjoy going to work and writing Python scripts for up to 60% of a typical work day. I love the language. I’ve also dabbled in JavaScript, CSS and HTML, but have only applied those to make simple, minimum viable websites. So why learn another language, Rust?

  1. Learning multiple languages enhances one’s understanding of computing. All languages tackle the same problems in different ways. Some leverage trade-offs enabling them to better solve specific computing problems than others. Seeing different approaches to the same challenges increases your understanding of the concepts.
  2. Rust is beloved by its developers. It scored highly on Stack Overflow’s 2019 developer survey. The most loved language was Rust, with 83.5% of developers saying they loved it. Python was tied for 2nd at 73.1% with TypeScript.
  3. Rust is an LLVM language, Python is not. Per Wikipedia, “The LLVM compiler infrastructure project is a set of compiler and toolchain technologies, which can be used to develop a front end for any programming language and a back end for any instruction set architecture.” It seems Rust opens up modularity to mesh with a bunch of other LLVM languages. Side note: LLVM started at my alma mater, the University of Illinois at Urbana-Champaign 😃 ILL 🔶🔷

LLVM was originally developed as a research infrastructure to investigate dynamic compilation techniques for static and dynamic programming languages. –Wikipedia

  1. Rust plays well with WebAssembly. AKA Wasm, a new standard introduced in 2015 that allows compilation of high performance browser or Desktop applications. I am still grappling with why Wasm is getting so much hype, but it seems to be a big deal. Rust opens doors to Wasm compatibility. Python is Wasm capable as well but I am getting the impression there is something in Rust’s design that makes it useful for compiling to Wasm.
  2. It is a modern language, which surfaced in 2010, that is still coming of age. This is both good and bad. But the good here is modern language design. Its creator saw the shortcomings of countless languages that have come before it. An enthusiastic community has already made Rust a good programming language option in a short time.

Getting Started with Rust

The Getting Started page contains a simple curl command for downloading and installing Rust via “Rustup”, an installer and version management tool. This will install Cargo, Rust’s package manager. (Think pip for Pythonistas.) I used my Linux environment on my Chromebook, but there’s a Windows executable available as well.

curl https://sh.rustup.rs -sSf | sh

rust_startup.png

Rust_stable _installed

The Cargo Book provides documentation for the package manager. I like the “First Steps with Cargo” section because it gets you immediately into creating and running a “build” by entering a few short commands in the terminal.

Create a New Build
cargo new hello_world
Rust_Hello_World

cd Into Your hello_world Program

Note the creation of a .toml manifest, and simple Rust program that prints “Hello, world!”.

Compile and Run Your Program
cargo run

Rust_cargo_runNow, on to learning the syntax, which is often compared to languages like C and C++. First stop for me will be “the book”, The Rust Programming Language. Cheers 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.