book icon indicating copy to clipboard operation
book copied to clipboard

Update *reference* definition to make it clearer in chapter 4.2

Open troglodytto opened this issue 2 years ago • 10 comments

troglodytto avatar Jun 03 '22 12:06 troglodytto

Can you clarify what you found to be unclear about the original and what is clearer to you about the new version?

carols10cents avatar Jun 03 '22 12:06 carols10cents

@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

troglodytto avatar Jun 05 '22 05:06 troglodytto

@carols10cents Any updates on this?

troglodytto avatar Jun 09 '22 08:06 troglodytto

I'm working on updating the book for print and I'll get to this the next time I'm revising chapter 4.

carols10cents avatar Jun 09 '22 13:06 carols10cents

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"

troglodytto avatar Sep 28 '22 17:09 troglodytto

@vinsburg Any updates on this?

troglodytto avatar Oct 01 '22 14:10 troglodytto

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)"

vinsburg avatar Oct 02 '22 18:10 vinsburg

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 ;)

troglodytto avatar Oct 03 '22 08:10 troglodytto

@vinsburg

troglodytto avatar Oct 07 '22 04:10 troglodytto

@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.

vinsburg avatar Dec 03 '22 07:12 vinsburg