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

Ch10-03: Improve paragraph on error messages about 'static #4067

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jpmelos
Copy link
Contributor

@jpmelos jpmelos commented Oct 12, 2024

In the section "The Static Lifetime", chapter 10-03.

Before:

2024-10-12_08-29_1

After:

2024-10-12_08-29

Here, I'm trying to address two things that I found weird about this paragraph:

  • The introductory phrase to the paragraph is not specific enough. The first time I read it, my immediate confusion was:

    People would suggest I mention lifetimes in error messages to the users of the software that I'm writing? Where would I see such suggestions? In other books? In blog posts? In conference talks? Is this common to suggest mentioning lifetimes in error messages to the users of our software? That's very weird.

    It never crossed my mind that this could be a suggestion coming from the compiler, because it doesn't read like it. It reads like it's talking about suggestions from other people (the default kind of suggestion). That was my first impression, at least. Then, the rest of the paragraph was very confusing as I was reading it from that perspective, and it didn't make any sense. I had to read it three times to finally realize I had misread the first phrase, and then it all made sense.

  • The phrase "and whether you want it to" reads like declaring lifetimes changes lifetimes at the will of the programmer, since it's just a matter of "want". However, in the section "Lifetime Annotation Syntax", a few folds above, it reads:

    Lifetime annotations don’t change how long any of the references live. Rather, they describe [...]

    2024-10-12_08-41

    That reads more realistic, so I'm assuming that that holds true, and not that declaring lifetimes changes lifetimes. So I would like to propose that we drop the phrasing "and whether you want it to" from this paragraph, since I can't make something live for the entire lifetime of the program just by declaring it with 'static.

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.

1 participant