-
Notifications
You must be signed in to change notification settings - Fork 30
Edit Chapter 09 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edit Chapter 09 #25
Conversation
What's happening here is that in the `read_version` function the local variable is being changed without modifying the slice in `main`. | ||
The `transaction_bytes` variable is being treated as a mutable *copy* of the pointer to the underlying data. | ||
|
||
Let me be more verbose since this can be pretty confusing for newcomers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm given this long paragraph, might make sense to add another diagram in here. Let me look into creating one that could help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was uncertain if you would approve this, but since you said there was some people with difficulty here I added anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i'm wondering if it makes more sense to replace all the extra text with a helpful diagram instead. So it doesn't feel too overwhelming to read.
So I did a little investigation here and I believe I'm explaining this slightly incorrectly, though the general idea is still the same. This line for example: This makes sense since when this memory address updates, it's consistently 4 greater than the previous memory address. So I updated the two diagrams that we can use to show what's going on here. I don't think the These are the two diagrams I have. Let me know what you think. |
Here is a PR I made to correct that explanation. Included the diagrams as well: #26 |
The new diagrams are a huge improvement. I tend to be more verbose and explain the figures I add in my texts anyhow, but I don't want to disturb your style. Based on people's difficulties and feedback, do you believe the diagrams are enough or there are more concept they are finding hard to grasp? |
Yeah I'm not sure. I think the diagrams might do a lot of heavy lifting though. They def helped me quite a bit when reading the Programming Rust book. |
I can see people getting confused with this, but I believe you did a great job explaining the copy of references. I tried to expand a bit and explain step by step what is happening. Please see the individual commits, in particular the top one.