Great stuff. Broken down so simply. Rust is fantastic. This is the type of stuff that C’s syntax lets your burn yourself on so easily. And this C++ was forced to lemming after it. The verbosity of syntax around this is a feature, and it makes your wonderful explanation as simple as just reading the code. Great language, great channel, great content! Thanks for saving me tons of time :D
I'm sitting here having a cocktail, and moving on to some nice whisky. This video is amazing! The content is very clear, and for me it's just reinforcing the idea that rust really isn't that different or special compared to other languages I know, it's just really explicit. You need to be absolutely clear about what you need a particular reference to do, and it's all built into the type system. Wonderful. Thankyou for this video.
Or you just need a one off workaround you know won't fail and don't want to rewrite when a simple tool for the situation was already provided by rust staff. Otherwise though mostly yeah
@@SharunKumar the idea is that your app's business logic already guarantees you won't overflow either value, and you just want the efficiency of using whatever type is native to your architecture.
Should we use smart pointers or is this an indication that we need to restructure our code? My question comes down to "Is this a cheat or bandaid for a problem with our project's architecture?"
Unless you're using raw pointers, some type of smart pointer is necessary to put values on the heap which is needed if you don't know how much memory you need to allocate for an object at runtime. That being said, I don't like interior mutability that much and it's a good idea to see if you can refactor your code first.
Great Video.💕 But just one suggestion. You should use Cell instead of RefCell in the Cons-list example. As i32 is a copy type, Cell is a better choice as it doesn't have a runtime overhead like RefCell. I feel like for copy types RefCell is an overkill.
Hmm, how is that manual ref counting actually better than something like a read write smart pointer in C++? It doesn't really check anything at compile time, so it's all runtime. And if it's all runtime it can still just panic. Which is functionally same as using a weak_ptr etc. Seems like there should be some very strong rules of thumb about when to use that. If I just sprincle RefCell all over the place, it seems to defeat the point of the language.
@@letsgetrusty Thank you so much. You are, in deed, converting a Gopher. Go's great, and I'll continue to use it. But at some point, the simplicity is limiting.
I'm a noob and I dont seem to understand why do we this instead of : pub trait Messenger { fn send(&mut self, msg: &str); } just making a mutable self reference
@@letsgetrusty I bet that question will come up more often in the future and people do not necessarily read all the comments or your replies. So my suggestion for a quick win: make a short video. Doesn't have to be longer than 5 minutes, just to explain your dev setup. People will appreciate it. And it will make it easy for you in the future to just link to it. If your setup ever changes, great. Another opportunity for yet another video 😊 (This is just a suggestion. Feel free to ignore.)
I think RUST is safe is the biggest misconception of all times. If there are tons of RefCell, Arc, Rc and others, all of them can panic at runtime. So I really can not understand how this can be called a safe language
@@32zim32Any language can panic at runtime. When people say Rust is safe, they are referring to MEMORY safety. Using Rc and RefCell may cause your code to panic but it won’t cause your program to have undefined behaviour
📝 Get your *FREE Rust cheat sheet* : www.letsgetrusty.com/cheatsheet
Great stuff. Broken down so simply. Rust is fantastic. This is the type of stuff that C’s syntax lets your burn yourself on so easily. And this C++ was forced to lemming after it.
The verbosity of syntax around this is a feature, and it makes your wonderful explanation as simple as just reading the code.
Great language, great channel, great content! Thanks for saving me tons of time :D
I'm sitting here having a cocktail, and moving on to some nice whisky. This video is amazing! The content is very clear, and for me it's just reinforcing the idea that rust really isn't that different or special compared to other languages I know, it's just really explicit. You need to be absolutely clear about what you need a particular reference to do, and it's all built into the type system. Wonderful. Thankyou for this video.
Borrow checking at runtime? I feel like if I have to use RefCell, there is something wrong with my design pattern.
Or you just need a one off workaround you know won't fail and don't want to rewrite when a simple tool for the situation was already provided by rust staff. Otherwise though mostly yeah
usize adapts to u32 or u64, depending on the architecture of the computer (32/64 bits). It's more "portable" to write it this way.
very interesting
Wouldn't this cause non-deterministic behavior like different overflow limits based on the target system 🤔
@@SharunKumar the idea is that your app's business logic already guarantees you won't overflow either value, and you just want the efficiency of using whatever type is native to your architecture.
Hi Bogdan,
thank you very much for all your videos !!! keep doing it, they are great!
Another super useful and enlightening video. Great work as always. Thank you!
Was waiting for this , keep it up bogdan!
The Halting Problem…. That was quite a curve ball in this context.
Nice
Excellent video. It's all about combining.
Should we use smart pointers or is this an indication that we need to restructure our code? My question comes down to "Is this a cheat or bandaid for a problem with our project's architecture?"
Unless you're using raw pointers, some type of smart pointer is necessary to put values on the heap which is needed if you don't know how much memory you need to allocate for an object at runtime. That being said, I don't like interior mutability that much and it's a good idea to see if you can refactor your code first.
Multi threading is almost impossible without async ref counting
Great Video.💕
But just one suggestion.
You should use Cell instead of RefCell in the Cons-list example. As i32 is a copy type, Cell is a better choice as it doesn't have a runtime overhead like RefCell.
I feel like for copy types RefCell is an overkill.
Next one Cell? 😉
I just wanna smash the like button infinite times bro !! Fantastic content 👍 need more rusty stuff
Amazing video as always :D
Fresh cut bro
I think IAM getting rusty!!
Great! But how can I handle the Panic and go on with my program?
sooo to know how to read the book
Very useful Thanks !
Could this be abstracted somehow? Seems unnecessarily complicated
Hmm, how is that manual ref counting actually better than something like a read write smart pointer in C++? It doesn't really check anything at compile time, so it's all runtime. And if it's all runtime it can still just panic. Which is functionally same as using a weak_ptr etc. Seems like there should be some very strong rules of thumb about when to use that. If I just sprincle RefCell all over the place, it seems to defeat the point of the language.
Help! I am trying to write macros! A macro series would be great! 😁
Coming soon!
@@letsgetrusty Thank you so much. You are, in deed, converting a Gopher. Go's great, and I'll continue to use it. But at some point, the simplicity is limiting.
I'm a noob and I dont seem to understand why do we this instead of :
pub trait Messenger {
fn send(&mut self, msg: &str);
}
just making a mutable self reference
remember kids use Cell instead of RefCell for primitives that implement copy
not a big fan of the Rc and RefCell example
great easy to understand, can you do the Fearless concurrency chapter? thanks
Yes I will!
go go Rusty
Smart Pointers in Rust are like shortcuts to avoid reference errors
What is your vscode setup?
it's very basic. I just use rust-analyzer and tabnine.
@@letsgetrusty I bet that question will come up more often in the future and people do not necessarily read all the comments or your replies. So my suggestion for a quick win: make a short video. Doesn't have to be longer than 5 minutes, just to explain your dev setup. People will appreciate it. And it will make it easy for you in the future to just link to it. If your setup ever changes, great. Another opportunity for yet another video 😊 (This is just a suggestion. Feel free to ignore.)
This seems pretty unsafe
I think RUST is safe is the biggest misconception of all times. If there are tons of RefCell, Arc, Rc and others, all of them can panic at runtime. So I really can not understand how this can be called a safe language
@@32zim32Any language can panic at runtime. When people say Rust is safe, they are referring to MEMORY safety. Using Rc and RefCell may cause your code to panic but it won’t cause your program to have undefined behaviour
i think ill call them smointers
huh
Good tutorial, but it looks like copy types got dissed