4 ms·
> I’ve been holding off learning Rust. Rust is quite an easy language to learn and a pleasurable language to use, due to its modern ergonomics and internal con
by gary17the 4y ago
> I’ve been holding off learning Rust.
Rust is quite an easy language to learn and a pleasurable language to use, due to its modern ergonomics and internal consistency. Give it a try. The only trick is that Rust newcomers actually need to read up on Rust borrow checker and lifetime annotations first, as opposed to learning Rust only through hacking with it. Those two concepts are unique to Rust and need to be well understood beforehand to avoid frustration.
- duped 4y agoI don't think Rust is easy to learn, it's has a kind of famously steep learning curve. The tooling is great which helps, but it's not easy for new-ish systems programmers.
- brink 4y agoYeah, I have to agree with this. I tried to get my team at my previous work to adopt Rust, and they all pretty much failed to really pick it up. Granted they weren't the most talented group I've worked with.
- DoesntMatter22 4y agoEvery video I've watched on youtube of Rust vs Go makes me think Rust is not a whole lot of fun to write.
- gary17the 4y agoThe borrow checker and lifetime annotations. It's always the borrow checker and lifetime annotations - otherwise Rust is, IMHO, as readable as (the excellent) Golang.
- dvlsg 4y agoI've often wondered what it would be like having a variant of Rust that was essentially the same underlying language, but with a garbage collector of some kind instead of a borrow checker and lifetime annotations.
- gary17the 4y agoYou can approximate this already: forget Rust references (borrow checking + lifetimes; in other words, raw pointers) and start hacking with Rust using its shared ownership (reference-counted) smart pointers, immutable Rc<T>[1], mutable RefCell<T>[2] and the combination of the two[3]. The syntax will, overall, get considerably more dense than Go, but otherwise analogous to Go. Instead of GC cycles, memory will be freed incrementally, immediately when no longer in use. [1] - https://doc.rust-lang.org/book/ch15-04-rc.html https://doc.rust-lang.org/book/ch15-04-rc.html [2] - https://doc.rust-lang.org/book/ch15-05-interior-mutability.html https://doc.rust-lang.org/book/ch15-05-interior-mutability.h... [3] - https://doc.rust-lang.org/book/ch15-05-interior-mutability.html#having-multiple-owners-of-mutable-data-by-combining-rct-and-refcellt https://doc.rust-lang.org/book/ch15-05-interior-mutability.h...
- duped 4y agoThat would be pretty close to OCaml.
- dvlsg 4y agoThat's fair. My favorite language so far has been F#, so maybe it's some of that preference sneaking through.
- icedchai 4y agoI've tried learning Rust after learning Go, never really got into it. I also know C, C++, Java, Python, PHP, JS, and a couple others (Perl, anyone?) I find Rust syntax too complex, similar to C++ which I also avoid now.
- hhjinks 4y agoIt's really frustrating to write, until it isn't. The language lets you be extremely expressive with about the same level of mental overhead as a garbage collected language. Once it "clicks," it's a joy to work with.
- gary17the 4y agoWell, you will probably think I'm crazy, but for me personally, having a couple of decades of C++ experience, learning Rust turned out to be much easier than learning... Swift. Yes, that famed, ultra-modern, great-as-your-first-programming-language Swift. Except for lifetime annotations and the borrow checker, Rust turned out to be much easier for my brain to parse and memorize than Swift, perhaps due to Rust's consistency and predictability and Swift's horrible language construct bloat.
- duped 4y agoGoing from C++ to Rust is pretty much the easiest path, since most of the "hard" parts of Rust are just automating stuff you do by hand in C++ anyway. For other languages where people regularly get tripped up on "what's the stack vs the heap?" coming to Rust it's a bit of a different story, ime. Talking about which object "owns" another that a pointer "outlives" what it points to are totally normal parlance for C++ developers and completely foreign to a lot of other folks.
- msbarnett 4y agoI don't disagree but that says to me that a lot of the "Rust is hard" narrative is actually "low-level systems programming is hard", eg) domain complexity is being misattributed to the language.
- palmtree3000 4y agoI came to rust from the other direction, as it were: from Haskell. There are a lot of similarities! The type systems are similar, with some name changes (sum types -> enums, typeclasses -> traits). Pattern matching is basically the same. Haskell uses (lazy) lists mostly the same way rust uses iterators. Ownership is new, but imposes some of the same requirements that immutability does (no cycles without shenanigans[0]). Rust requires that values are aliasable XOR mutable: Haskell does too (they're always aliasable and never mutable). [0] https://wiki.haskell.org/Tying_the_Knot https://wiki.haskell.org/Tying_the_Knot
- chakkepolja 4y ago
- dexwiz 4y ago> Rust is quite an easy language to learn ... [except for these two incredibly complex topics that permeate the entire language] For anyone coming from a GC language, Rust is a huge change.
- gary17the 4y agoYes, good point, a switch from a GC-based language to a memory ownership -based language is definitely non-trivial, but you can always just forget Rust references altogether for the time-being and start hacking with Rust with its reference-counted smart pointers, effectively learning Rust as if it were Go. (You will have to switch back to Rust ownership/references later on to get back the performance and the respect of other Rustaceans 8) .)
- Spivak 4y agoI mean that's only two things! /hj
- preseinger 4y agoRust is not an easy language to learn. Among languages in common use, it is almost certainly the most difficult language to learn.
- baq 4y agoDisagree. C++ is the most difficult - the compiler accepts programs which Rust would reject and then they segfault or worse.
- preseinger 4y agoThat's true, but it doesn't mean C++ is harder to learn. Rust has a broader and more novel conceptual surface area than C++. This is what influences difficulty, not memory safety guarantees.
- baq 4y agoI postulate that a lot of folks confuse ‘easier to learn’ with ‘easier to get code to compile’ and I disagree that the two are the same. Rust makes it more obvious sooner that you have soooo much to learn.
- preseinger 4y agoRust presents a programmatic model to its users that is exceptionally broad. That model is not objectively more correct, or better, or whatever else, than the model presented by other languages. It provides different guarantees, and extracts different costs, and lifts different concerns into the domain of its users, compared to alternatives. Those particular costs and benefits make sense for certain use cases, and don't make sense for others.
- kortex 4y ago> Rust is quite an easy language to learn It's funny. I hear two different things, all the time. "Rust is easy to learn" and "Rust has a steep learning curve". Personally, I found it to be the latter, and that's as a serial dabbler/language polyglot. I had a bear of a time wrapping my head around lifetime annotations, and needed someone already familiar with them to sherpa me through that stage. I think it does a disservice to say, "Rust is easy to learn modulo these two really challenging concepts, plus some other things you are likely unfamiliar with". Python is easy to learn. C++ is hard to learn. I'd rate rust as medium difficulty. It sure is enjoyable though, I don't think that's ever in doubt.
- boppo1 4y agoWhat makes C++ so hard to learn?