book
book copied to clipboard
Update *reference* definition to make it clearer in chapter 4.2
Can you clarify what you found to be unclear about the original and what is clearer to you about the new version?
@carols10cents The wording of this sentence is a bit confusing, even to native english speakers, let alone non-native speakers
reference is like a pointer in that it’s an address
In the new version, the flow of the sentence is simple, which makes it easier to understand the underlying concept
reference is like a pointer, i.e it's an address
@carols10cents Any updates on this?
I'm working on updating the book for print and I'll get to this the next time I'm revising chapter 4.
That can undermine the "definition" of the word reference in a sense, i.e what the word reference actually means, So what about..
"A reference is like a pointer, i.e a variable that stores the address of the data owned by another variable; An address that we can follow in order to access the data stored at that address (data, which is owned by some other variable). However, unlike a pointer, a reference is guaranteed to point to a valid value of a particular type for the lifetime of that reference. This is because the compiler checks for the validity of that value at compile time"
@vinsburg Any updates on this?
Sorry, busy week :) Looks good all in all. I assume you meant to remove the repeated explanation of data ownership inside the brackets "(data, which is owned by some other variable)"
Yes! Although, keeping the duplication might help clarify the point since it can mean the reference variable itself or the variable that it's pointing to, and it can be a bit vague. It's better to be explicit, just like most things in Rust ;)
@vinsburg
@troglodytto I think both approaches are plausible. I assume we are still waiting for the book print before these changes and others are revised by @carols10cents.