16 Jan 24

Learning Rust by comparing to Ruby

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

  • Debugging:

  • Pry and Debug vs dbg

  • Look into rust-gdb, and rust-lldb

  • Println vs puts

  • Eprintln

  • OO

  • is Rust OO?

  • Array vs Vector

  • Strings

    • String and &str
  • Variables

  • declaring types

  • Constants

  • let

  • General structure:

  • Classes vs Structs

  • Main function vs first line

  • Traits vs Mixins

  • Modules

  • File Structure

  • mod vs zeitwerk

  • Struct vs Hash

  • Tests

  • Unit testing

  • Integration testing

  • Logging

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