10 Mar 24

Learning Rust by comparing to Ruby
Originally posted on Medium

For the past month, I have been learning Rust. While doing so, I’ve been comparing it to another language I am very fluent in–Ruby. The languages are vastly different and their ecosystems advocate for different use cases as well, but a string is a string. And a struct is a struct. Or are they?

When attempting to learn languages, either because I’m curious or because a project uses them, I go through a mental checklist that starts with the fundamentals. How do I get started? How are variables declared? What objects are available? This seems to cover nearly any language. So this has been my approach to Rust.

In a series of posts, I will cover a specific fundamental and compare it to Ruby, providing as near equivalent code samples as I can. Some may illustrate a point, but those will be noted.

I’m still forming an Archipelago of Ideas regarding topics, but here is a work in progress to give a sense of what future posts will cover:

Getting Started:
Cover the installers (brew and Ruby’s/rvm and rustup)
File extensions
How to run your code
Pry and Debug vs dbg
Look into rust-gdb, and rust-lldb
Println vs puts
is Rust OO?
Array vs Vector
- String and &str
declaring types
General structure:
Classes vs Structs
Main function vs first line
Traits vs Mixins
File Structure
mod vs zeitwerk
Struct vs Hash
Unit testing
Integration testing

If you’re interested in learning Rust in small chunks, please follow. I will keep a regular cadence, tentatively every Friday. And as always, feedback is welcome!