Originally posted by mdedetrich
View Post
Announcement
Collapse
No announcement yet.
The Latest Progress On Rust For The Linux Kernel
Collapse
X
-
Originally posted by cl333r View PostUtterly and terminally ignorant and wrong. The borrow checker is Rust's mechanism of dealing with borrowing rules.
- Likes 3
Comment
-
Originally posted by jacob View Post.. which brings us back to concurrency - obviously a callback is by nature not deterministic.
- Likes 1
Comment
-
Originally posted by cl333r View PostSays the clueless Rust fanboy. RefCell doesn't do reference counting at all. Rc does, hence Rc<RefCell> or RefCell<RC>. So eat shit again.
- Likes 2
Comment
-
Originally posted by tomas View Post
What do you mean by this? If I have a single process, single threaded program then I can't see why a callback would not be deterministic? It's just like any other function call within your program and it's not executed at an arbitrarily point in time. In fact it's executed exactly at the same point in time every time assuming the program has the same inputs and does not rely on any external event. So by itself, I can't see why a "callback function" would not be "deterministic"?
- Likes 3
Comment
-
Originally posted by jacob View Post
Actually you are incorrect, RefCell doesn't do reference counting, that's Rc and Arc. The "Ref" in RefCell simply means that you can borrow() a reference to the object (as opposed to a plain Cell which will give you a copy of the object). It only has a borrowed/not borrowed flag, not a reference counter.
It actually does but of course its not the exact same as a normal reference counter. RefCel creates a struct that contains a counter for the number of times its borrowed or a special value if its a mutable reference (the struct also contains the actual value).
Using methods such as borrow increases that counter, which is basically the same way how reference counter works (i.e. counting how many references an object has).
Maybe the implementation details has changed since then ¯\_(ツ)_/¯Last edited by mdedetrich; 13 September 2021, 02:38 AM.
Comment
-
Originally posted by tomas View Post
What do you mean by this? If I have a single process, single threaded program then I can't see why a callback would not be deterministic? It's just like any other function call within your program and it's not executed at an arbitrarily point in time. In fact it's executed exactly at the same point in time every time assuming the program has the same inputs and does not rely on any external event. So by itself, I can't see why a "callback function" would not be "deterministic"?, you can have multiple tasks running on a single thread with tokio with can make you program not deterministic because it relies on external events to be done and can jump around the program in different execution points.
- Likes 1
Comment
-
Originally posted by mdedetrich View Post
https://www.reddit.com/r/rust/commen...l_and_refcell/
It actually does but of course its not the exact same as a normal reference counter. RefCel creates a struct that contains a counter for the number of times its borrow or a special value if its a mutable reference (the struct also contains the actual value).
Using methods such as borrow increases that counter, which is basically the same way how reference counter works (i.e. counting how many references an object has).
- Likes 2
Comment
-
Originally posted by dragonn View PostAsync programing, you can have multiple tasks running on a single thread with tokio with can make you program not deterministic because it relies on external events to be done and can jump around the program in different execution points.
- Likes 1
Comment
-
Originally posted by jacob View Post
That's actually true for the non-mutable borrows but it's not reference counting for memory management.
- Likes 1
Comment
Comment