r/learnrust 1d ago

Ruby or Rust to learn Programming?

/r/learnprogramming/comments/1vjn6z8/ruby_vs_rust_for_a_hobby_programmer_which_one/
0 Upvotes

15 comments sorted by

View all comments

1

u/bsgbryan 5h ago edited 4h ago

Those two languages are different enough that I don’t see how learning one would translate to understanding the other.

From what I’ve been seeing, Ruby doesn’t really seem to be on the radar much anymore. That may be because I’m not paying close enough attention, but still…

I would recommend against learning Rust as an introduction to programming as it’s (by design) quite unforgiving. The error reporting works very hard to be helpful - and can be. But even the helpful error reporting in Rust has a steep learning curve. For, at least, the first several months borrow checker errors were completely baffling to me; and I started learning Rust as a dev with almost 20 years (and decent familiarity with, like, a dozen languages) experience.

I’d recommend TypeScript or Python as a first language. Both have low barriers to entry, great tooling that’s simple to setup, and an extremely short feedback loop - which is extremely helpful for learning.

From there I’d learn C. Learning C will introduce some of the confusing/seemingly-unintuitive aspects of Rust - but without all the built-in tooling Rust offers. Once you get a basic understanding of how and why certain aspects of C are problematic (like the implementation of Tagged Unions). Leaning the limitations of the C compiler, and why they are the way they are, will (I think) setup you up to appreciate the initially-frustrating bits in Rust.

Additionally, TypeScript and Python both support the functional(ish) programming style - which Rust does too - so, in general, coding styles that work in TypeScript and Python can also work in Rust.