3 ms·
> I could see how it would be hard for someone whose only background is in js or python. As someone who has trained several Rust programmers, I've seen people
by ekidd 4y ago
> I could see how it would be hard for someone whose only background is in js or python.
As someone who has trained several Rust programmers, I've seen people hit two major snags:
- Like TypeScript, Rust is a strongly-typed language that gently encourages functional programming.
- Like C/C++, Rust is a language where you need to know about references vs values, and the stack vs the heap.
Someone who's comfortable in TypeScript and C++ will often take to Rust like a duck to water. But someone who's never called "map" or who has never worked with pointers may take longer. A pure C programmer might struggle as much as pure Python programmer, just from the opposite direction.
That said, I love Rust precisely because it allows me to move between a TypeScript mindset and a C mindset as needed. When I want something fast, solid, correct and easy to maintain, it's my favorite tool. But for many team projects, Rust is overkill—garbage collected languages are often perfectly affordable. And there are many excellent choices!
- mr_00ff00 4y agoNever heard this before but will now look out for it. I was always surprised when people said rust had a steep learning curve, yet it seemed relatively easy to pick up to me. My first language in school was C++ and my first language on the job was Typescript, exactly as you described. I knew both well and then heard about rust and tried it.
- matwood 4y ago> But someone who's never called "map" or who has never worked with pointers may take longer. When I wrote my comment I was thinking way back to when I was in undergrad and pointers were a huge stumbling block for many. Maybe things have changed, but if someone hasn't had to think about them ever, it could make learning a language with explicit pointers challenging. That's not say people can't learn, I'm just thinking about how long it takes someone to get up to speed.
- ekidd 4y ago> Maybe things have changed, but if someone hasn't had to think about them ever, it could make learning a language with explicit pointers challenging. To be clear, safe Rust doesn't actually have pointers. (Well, it does, but only unsafe Rust can dereference them.) But Rust does have pass by value and pass by reference. It has both stack allocation and heap allocation. And it has a notion of who "owns" something. These aren't technically pointers, but taken together, they're basically a safe interface to doing "pointer stuff." Conceptually, all these ideas should make sense to anyone who has worked with pointers and allocation. Similarly, Rust allows easy mutable state as long as only one piece of code can see the mutation happen. But many programmers are used to being able to share mutable state between widely separated bits of code. And this affects how you design the architecture of your program! Anyone who has done functional programming will see the implications of this early: "Oh, I need build my architecture around immutable state!" So something like an old-school game engine where any entity can update any other entity is a huge headache in Rust. But a game architecture like ECS that carefully restricts mutation (like Bevy) works beautifully with in Rust. I don't want to trivialize this: Pointer stuff and mostly-functional architectures are both real skills that take time to learn. Rust is amazing for situations where you feel torn between TypeScript and C/C++. But lots of projects just need a nice GCed language and a good standard library, and Rust wouldn't be the right choice for many teams.
- cssanchez 4y agoI agree with you. I’m learning Rust as a Python-only (bit of Typescript) mostly data-analyst experience and Rust has been challenging, but I’m slowly getting it thanks in part to its new popularity and variety of tutorials. That said I don’t get what you meant by knowing about the stack vs heap in Rust. I’m not from C++ land so maybe this flew over my head, could you elaborate?