Skip to content
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

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

Closed
wants to merge 7 commits into from

Conversation

troglodytto
Copy link

No description provided.

@troglodytto troglodytto changed the title Update *reference* definition to make it clearer Update *reference* definition to make it clearer in chapter 4.2 Jun 3, 2022
@carols10cents
Copy link
Member

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

@carols10cents carols10cents added this to the ch4 milestone Jun 3, 2022
@troglodytto
Copy link
Author

troglodytto commented Jun 5, 2022

@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
Copy link
Author

@carols10cents Any updates on this?

@carols10cents
Copy link
Member

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

Copy link
Contributor

@vinsburg vinsburg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good proposal, but I think we can untangle it a bit more. how about?:

Like a pointer, a reference holds the address to data owned by another variable, we can follow it to access the data.
Unlike a pointer ....

@troglodytto
Copy link
Author

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
Copy link
Author

@vinsburg Any updates on this?

@vinsburg
Copy link
Contributor

vinsburg commented Oct 2, 2022

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

@troglodytto
Copy link
Author

troglodytto commented Oct 3, 2022

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
Copy link
Author

@vinsburg

@vinsburg
Copy link
Contributor

vinsburg commented Dec 3, 2022

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

Copy link
Contributor

@chriskrycho chriskrycho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I am noting this section to make sure Carol or I look at it again as we do revisions, but in the case of this specific PR, I think the new text is pretty similar to the old text in terms of how clear it is. If we decide to tackle this in some way, we will likely rewrite the sentences entirely rather than just tweaking the wording. (This is by no means a commitment to doing that, though; we may decide it is just best left as it is!) Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants