Live data from Hacker News

Rust – What made it “click” for me (Ownership and memory internals)

deavid.wordpress.com

1–10 of 76 posts

Re: Rust – What made it “click” for me (Ownership and memory internals)

#2
> As said earlier, C++ developers have an advantage on understanding Rust because they have a mental model of what the memory looks like, pointers and so on

The immeasurable success of Rust certainly lies in its clear communication and forcing developers to learn about the basics of hardware.

I can't help but to feel validated in thinking that every developer worth its salt should know about these basics anyway. But I have to admit that not everybody comes with a CS background.

Re: Rust – What made it “click” for me (Ownership and memory internals)

#3

> As said earlier, C++ developers have an advantage on understanding Rust because they have a mental model of what the memory looks like, pointers and so on The immeasurable success of Rust certainly lies in its clear communication and forcing developers to learn about the basics of hardware. I can't help but to feel validated in thinking that every developer worth its salt should know about these basics anyway. But…

Agree. The problem is that languages like Java, C#, ... are making it so easy not to worry about memory that we (at least I) tend to forget the basics after a decade or so. And the basics have mostly stayed the same.

Re: Rust – What made it “click” for me (Ownership and memory internals)

#4

> As said earlier, C++ developers have an advantage on understanding Rust because they have a mental model of what the memory looks like, pointers and so on The immeasurable success of Rust certainly lies in its clear communication and forcing developers to learn about the basics of hardware. I can't help but to feel validated in thinking that every developer worth its salt should know about these basics anyway. But…

I'm not so sure that C++ gives an advantage. It's a different paradigm.

Re: Rust – What made it “click” for me (Ownership and memory internals)

#5

> As said earlier, C++ developers have an advantage on understanding Rust because they have a mental model of what the memory looks like, pointers and so on The immeasurable success of Rust certainly lies in its clear communication and forcing developers to learn about the basics of hardware. I can't help but to feel validated in thinking that every developer worth its salt should know about these basics anyway. But…

I know the basics.

But manually managing memory lifetimes you only learn from a lot of exposure to C/asm.

In my first 3 months of Rust, I spent an equal amount of time with the type-checker and the borrow-checker. A year in and I don’t really have a separate phase of resolving borrow-check errors before I can compile.

People with more C exposure tend to think that way already.

Re: Rust – What made it “click” for me (Ownership and memory internals)

#6

> As said earlier, C++ developers have an advantage on understanding Rust because they have a mental model of what the memory looks like, pointers and so on The immeasurable success of Rust certainly lies in its clear communication and forcing developers to learn about the basics of hardware. I can't help but to feel validated in thinking that every developer worth its salt should know about these basics anyway. But…

Agree. The problem is that languages like Java, C#, ... are making it so easy not to worry about memory that we (at least I) tend to forget the basics after a decade or so. And the basics have mostly stayed the same.

You still end up worrying about memory eventually, and the solution will often be to purchase more memory - which can be a fine tradeoff to make at times.

Re: Rust – What made it “click” for me (Ownership and memory internals)

#7

> As said earlier, C++ developers have an advantage on understanding Rust because they have a mental model of what the memory looks like, pointers and so on The immeasurable success of Rust certainly lies in its clear communication and forcing developers to learn about the basics of hardware. I can't help but to feel validated in thinking that every developer worth its salt should know about these basics anyway. But…

I don't see how understanding pointers and memory layout help at all with borrowing concepts.

Re: Rust – What made it “click” for me (Ownership and memory internals)

#8

> As said earlier, C++ developers have an advantage on understanding Rust because they have a mental model of what the memory looks like, pointers and so on The immeasurable success of Rust certainly lies in its clear communication and forcing developers to learn about the basics of hardware. I can't help but to feel validated in thinking that every developer worth its salt should know about these basics anyway. But…

I'm not so sure that C++ gives an advantage. It's a different paradigm.

If you’re a safe c++ programmer who never writes code that has memory errors, you need to be tracking ownership and lifetimes.

Once you get your head around the borrow checker, Rust takes a lot of that cognitive load off you, by tracking things for you at compile time and dinging you on it if you get something wrong.

Re: Rust – What made it “click” for me (Ownership and memory internals)

#9

> As said earlier, C++ developers have an advantage on understanding Rust because they have a mental model of what the memory looks like, pointers and so on The immeasurable success of Rust certainly lies in its clear communication and forcing developers to learn about the basics of hardware. I can't help but to feel validated in thinking that every developer worth its salt should know about these basics anyway. But…

> not everybody comes with a CS background.

Something doesn't sit quite right with me to describe the "basics of hardware" as being something that comes with a "CS background".

I come from a formal CS background, and we spent more time dealing with finite state automatons, programming language theory, and other aspects of abstract computation. Getting down and dirty with data sizes, system components, and bit fiddling was an available, but optional path. We all spent one or two courses dealing with the practical nature of computers, but it was largely drowned out by theory, at least in my program.

Re: Rust – What made it “click” for me (Ownership and memory internals)

#10
post #7

> As said earlier, C++ developers have an advantage on understanding Rust because they have a mental model of what the memory looks like, pointers and so on The immeasurable success of Rust certainly lies in its clear communication and forcing developers to learn about the basics of hardware. I can't help but to feel validated in thinking that every developer worth its salt should know about these basics anyway. But…

I don't see how understanding pointers and memory layout help at all with borrowing concepts.

They don't. They're fairly orthogonal concepts. You can have a concept of lifetimes without memory management (for example, the object changes state while you have a reference to it).
Post reply on HN