You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am very much enjoying reading the Chapter 4.2 of this book with how the R, W and O permissions work, but I was sad to see the section at the end with the F permission where it sort of glosses over it. From reading that part my understanding of the F permission is limited to that it is required to use input/output reference in an expression, it's a separate mechanism from the prior R, W, O that is used for references inside the body, and that it might have something to do with lifetimes. I am shown some examples of the F permission in action but none demonstrate to me how it is determined whether something has the F permission or not, unlike RWO for which I have some idea of how the compiler would step through the code and decide how to enable/disable the permissions along the way.
I think including an explanation of this would really be a step forward allowing readers to understand in depth how Rust exactly works, which would be immensely valuable. Currently the official Rust Book kind of just handwaves the concepts of ownership and borrowing, such that a reader of that book doesn't actually find out how the language works, cannot build a mathematical model of the language in their head and therefore cannot look at a piece of code and determine if it would compile. But I think this book really has the potential to do that as it is able to walk you through the borrow checker logic.
Again, thank you for this book, it is giving me the chance to understand Rust.
The text was updated successfully, but these errors were encountered:
The short explanation: say you have an expression that has an actual type &'a T and an expected type &'b T for some lifetimes 'a and 'b. The expression needs the F permission if 'b is a lifetime that escapes the current function. The expression has the F permission if 'a outlives 'b, i.e. 'a: 'b is true.
I agree that the current explanation in the book is too cursory. I'm also not fully certain that the F permission is the ideal way to represent these valid or invalid flows.
I am very much enjoying reading the Chapter 4.2 of this book with how the R, W and O permissions work, but I was sad to see the section at the end with the F permission where it sort of glosses over it. From reading that part my understanding of the F permission is limited to that it is required to use input/output reference in an expression, it's a separate mechanism from the prior R, W, O that is used for references inside the body, and that it might have something to do with lifetimes. I am shown some examples of the F permission in action but none demonstrate to me how it is determined whether something has the F permission or not, unlike RWO for which I have some idea of how the compiler would step through the code and decide how to enable/disable the permissions along the way.
I think including an explanation of this would really be a step forward allowing readers to understand in depth how Rust exactly works, which would be immensely valuable. Currently the official Rust Book kind of just handwaves the concepts of ownership and borrowing, such that a reader of that book doesn't actually find out how the language works, cannot build a mathematical model of the language in their head and therefore cannot look at a piece of code and determine if it would compile. But I think this book really has the potential to do that as it is able to walk you through the borrow checker logic.
Again, thank you for this book, it is giving me the chance to understand Rust.
The text was updated successfully, but these errors were encountered: