4 ms·
I really think rust is great, but after learning what memory management is. Teaching rust first would just be a weird memorization of rules that you might not
by mr_00ff00 4y ago
I really think rust is great, but after learning what memory management is.
Teaching rust first would just be a weird memorization of rules that you might not appreciate.
- zozbot234 4y agoThe borrow checking rules of Rust are anything but "weird". They boil down to not mixing up shared references and exclusive borrows; and, more subtly, preserving the distinction between temporary borrows and complete ownership. (I.e. only the owner can dispose an object; when borrowing, you can only give it back.) That's quite teachable, albeit using these rules in practice is not nearly as easy.
- nequo 4y agoI agree, if C++ can be taught then so can Rust. But pedagogically, it is difficult to motivate why we can’t read a reference and mutate it in the same scope, since Python, JavaScript, Ruby, Lua, Lisp, Java, OCaml, C, etc. all allow it. It is much easier to accept this hurdle after having seen and debugged memory bugs and data races in, e.g., C.
- mr_00ff00 4y agoI’m sure it could be, and maybe I am wrong but I know people say rust has a rough learning curve. I learned C and Typescript before ever touching rust, and I feel like I experienced no rough introduction. Maybe it’s anecdotal, but I always assumed I learned memory and semi-functional programming first, which made rust a breeze.
- cxr 4y ago> Teaching rust first would just be a weird memorization of rules that you might not appreciate. That's pretty much exactly the situation with first-time programmers who are taught Java—none of the background to know why it makes the decisions it does.