The conversation

Lessons learnedExperience excerpt · English

I have learned multiple programming languages, of many different paradigms, and never had the …

… I have learned multiple programming languages, of many different paradigms, and never had the trouble getting to the stage of writing useful software that I have had with Rust. I've witnessed the same again and again with all the people I know - all professional programmers. In fact I'm the only one I know who's stayed with it. I find the denial of Rust's difficulty (and not even centred on the borrow checker - it's the use of just about every commmon library) just very very strange. Odd enough (and distant enough from the obvious, adn the experience of every person I've known) that I find it completely incomprehensible.

Original discussionRust for Professionals100 source comments · at import
4

What was this responding to?

Parent context · original excerpt

IN

> You truly don't find that hard or complicated? This is like saying: "You think a 64bit integer is simple? OK, let's dig into the C memory model, twos complement, overflow CPU flags, how CPU caches are implemented, architectural nuances that can lead to unsynced writes from registers to RAM, etc". In reality most people can just learn that it's a number that holds 2^64 values, not complicated. If you want to really understand integers though go read the intel manual and the C memory model specification. Are lifetimes complicated? If you're a compiler developer who needs to consider the implications across all features and edge cases, yes . If you're learning the language and you just want to write "find me a &str in another &str but don't clone it", no, it's not complicated at all. The vast majority of beginners can just learn "& means any number of readers and no writers, &mut means on…

Full original

Community replies 0

No community replies yet. Add your perspective.

Replies from the source 4

Direct replies available in this import. Original-language excerpts.

IN

The rust borrow checker has been described in trivial terms many times. The first time I had it explained, as I recall, was as a book. You own a book. `&` - You can lend others the book, they can't fuck with it. `&mut` - You can lend the book to one person, they can fuck with it `move` - You give someone else the book, it's theirs now Or `many reader NAND one writer` Is this a complete explanation? No. But it's quite simple and you can be plenty productive with just this amount of understanding. Your experience is not my experience. I used Rust for the first project I wrote as an intern after dropping out, having never used it before, and I even used it to interact with mysql, which I had never used before. At my last company I had multiple people pick up rust in a matter of days. I'm not denying rust as being difficult, I'm saying it's easy for some and hard for some. I found it easy, I…

Full original
ZO

> Rust is harder than any other mainstream language to do that in. It's not hard, you just add boilerplate. Cloning data, using interior mutability, or adding ref counting to deal with cases where multiple "owners" can keep an object around independently. Then removing the boilerplate is how you do optimization, once you've gotten things to work. The opposite of other languages where low-level code is the most verbose and least intuitive.

Full original
NI

> Rust is harder than any other mainstream language to do that in. I’d argue C and C++ are both harder. It’s hard to even get these to build once you move past trivia examples (including libraries etc). > I find the denial of Rust's difficulty (and not even centred on the borrow checker - it's the use of just about every commmon library) just very very strange Some of us just didn’t find it that hard. Like, I get that its hard for people in theory, because I’ve seen enough people express this that I believe it must be a common experience. But my personal experience was a couple of weeks of slow progress and lots of puzzling, and then everything became much easier, coupled with a joy that most of the language is so much better designed than the previous generation of languages I was used to using (e.g. it actually has sum types, and everything is an expression - why on earth doesn’t every…

Full original
JC

From the standpoint of being productive in Rust, this is what you need to know: * An object has a lifetime. This generally lasts until overwritten or destroyed at end of scope. * You can loan out references to this object. You can either have a single &mut, xor an unlimited number of & references, but not both. * References cannot outlast the lifetime of the object they point to. * If you have a &mut reference to an object, you can give out another &mut reference to the same object. But you can't use the first reference for the duration of the second. * Lifetimes can be named, and you can express criteria of the form "this lifetime must at least/most this long." * Bonus: if you have &mut x, you can give out &mut x.a and &mut x.b at the same time . But you can't give out &mut x while such a subreference is live. And... that's really all you need. Yeah, there's a lot more rules, and there'…

Full original
Continue on Hacker News

Respect different perspectives. Share concrete experiences.

Sign in to post, reply, repost, and quote.