rust ownership is simple after this

  Рет қаралды 3,997

Caleb Curry

Caleb Curry

6 ай бұрын

Пікірлер: 14
@vipranarayan14
@vipranarayan14 Ай бұрын
The first video where I understood borrowing clearly. Thanks!
@stompman
@stompman 2 ай бұрын
great video! borrow-checking isnt so complicated, especially if youve used RAII in c++ or in general use best practice when working with languages that use pointers for references
@steveoc64
@steveoc64 6 ай бұрын
How to be more productive with Rust in 2024 ? Just delete it Use C or Zig, or C++ or Go, depending on your actual requirements
@porkypig7170
@porkypig7170 2 ай бұрын
What’s wrong with rust
@ItsCOMMANDer_
@ItsCOMMANDer_ 6 ай бұрын
Thats one of the reasons i dont like rust, i'll just stick with c
@steveoc64
@steveoc64 6 ай бұрын
Ikr. So many examples of perfectly valid and safe code that won’t even make it past the compiler is ridiculous. And this video short is only the tip of a very nasty iceberg. It’s basically someone else’s power trip fantasy rules about “clean code”, forced down your throat for no real benefit. All these arbitrary rules that are not in the slightest context free, is a disaster waiting to happen when this code needs to be maintained in future.
@climatechangedoesntbargain9140
@climatechangedoesntbargain9140 6 ай бұрын
two facts: 1. there is a real benefit, which is guaranteed memory safety 2. the rules aren't arbitrary I have been extending 5 year old Rust code just fine@@steveoc64
@stompman
@stompman 2 ай бұрын
​@@steveoc64wow, you are so cool and so edgy for being vulnerable to use-after-frees because the new college intern assigned to work on your 10000+ loc c++ codebase doesnt know how to implement RAII
@steveoc64
@steveoc64 2 ай бұрын
@@stompman lol. We don’t have C++ codebases, and we don’t use interns for systems programming.. so no problem here :)
@steveoc64
@steveoc64 6 ай бұрын
And btw - rust didn’t invent the ownership model .. that was all done in the 1970s - 1980s. It’s just another form of garbage collection, and those previous attempts never took off either… go figure.
@thegoldenatlas753
@thegoldenatlas753 6 ай бұрын
Clearly you don't get ownership model if you think its the same as garbage collection.
@steveoc64
@steveoc64 6 ай бұрын
@@thegoldenatlas753 other way around.. you don’t get what “garbage collection” is. You are thinking that mark and sweep is the only garbage collection strategy. The ownership model that Rust uses (taken directly from Simula I) is a form of garbage collection. As is reference counting and RAII. Mark and sweep was invented in the 80s as a more performant method, at a time when the syscall overhead was large.
@stompman
@stompman 2 ай бұрын
youre wrong lol rust's ownership model is really similar to RAII, however it has nothing to do with garbage collection, just like RAII has nothing to do with garbage collection garbage collection is the program automatically freeing unused heap allocated values or other unused memory at runtime. rust doesnt do this at runtime, but instead at compile time by automatically inserting destructors after a value goes out of scope, and in order to do this reliably and efficiently, the ownership model has to be enforced by the compiler. this leads to higher performance, as the runtime doesnt have to count references, do mark and sweep, etc., all while ensuring memory safety
@steveoc64
@steveoc64 2 ай бұрын
@@stompman and those “automatically created” destructors are run at .. runtime. Your comment proves my point anyway. If you were writing something like a web serving app, or a database server, etc, then you can’t benefit from using arena allocators per request, because the borrow checker is dumb, and doesn’t understand the outer context of an arena. Your rust program ends up making a bunch of frees where none is needed (let alone specified in the code). Frees are system calls, and system calls cost time. This is why rust web server apps or db servers will never hit the same performance numbers as C or zig based alternatives. Unless you write the whole thing in unsafe mode, at which point you have lost the battle anyway. It’s even worse when you look at the “automatically generated” wasm output that the rust toolchain spits out, because it assumes you are targeting a traditional PC architecture, and can’t cope with how wasm VMs use memory in a very different way. It’s just not a good fit for systems programming, no matter how much “safety” lipstick you put on the pig
non-lexical lifetimes
0:59
Caleb Curry
Рет қаралды 3,5 М.
Rust References and Ownership Complete Introduction
28:45
Caleb Curry
Рет қаралды 3,3 М.
Survival skills: A great idea with duct tape #survival #lifehacks #camping
00:27
He sees meat everywhere 😄🥩
00:11
AngLova
Рет қаралды 11 МЛН
LOVE LETTER - POPPY PLAYTIME CHAPTER 3 | GH'S ANIMATION
00:15
Why You Should AVOID Linked Lists
14:12
ThePrimeTime
Рет қаралды 271 М.
Why i think C++ is better than rust
32:48
ThePrimeTime
Рет қаралды 279 М.
Rust makes you feel like a GENIUS
10:48
No Boilerplate
Рет қаралды 401 М.
Rust for TypeScript devs : Borrow Checker
8:49
ThePrimeagen
Рет қаралды 216 М.
This Is How Rust Stops Memory Leaks
5:53
Low Level Learning
Рет қаралды 157 М.
SQLite3 in Node with better-sqlite3
12:08
Caleb Curry
Рет қаралды 4,8 М.
WebAssembly Introduction - Getting Started with Wasm
12:07
Caleb Curry
Рет қаралды 10 М.
Learning Rust: Memory, Ownership and Borrowing
7:46
YouCodeThings
Рет қаралды 89 М.
Why I Don't Use Else When Programming
10:18
Web Dev Simplified
Рет қаралды 1,2 МЛН
SQLite Introduction - Beginners Guide to SQL and Databases
21:49
Caleb Curry
Рет қаралды 21 М.
Опыт использования Мини ПК от TECNO
1:00
Андронет
Рет қаралды 702 М.
Klavye İle Trafik Işığını Yönetmek #shorts
0:18
Osman Kabadayı
Рет қаралды 217 М.