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 lifetimes to include anonymous lifetime syntax #1273

Open
steveklabnik opened this issue Apr 3, 2018 · 6 comments
Open

Update lifetimes to include anonymous lifetime syntax #1273

steveklabnik opened this issue Apr 3, 2018 · 6 comments
Assignees
Labels
Enhancement feature-stabilized the stabilization has landed and so this is ready to go
Milestone

Comments

@steveklabnik
Copy link
Member

This issue tracks inclusion of the new '_ syntax into the Book. This will happen in the 2018 edition.

Tracking issue: rust-lang/rust#48469

@steveklabnik steveklabnik self-assigned this Apr 3, 2018
@steveklabnik steveklabnik added the feature-stabilized the stabilization has landed and so this is ready to go label Apr 26, 2018
@steveklabnik steveklabnik added preview 2 and removed feature-stabilized the stabilization has landed and so this is ready to go preview 2 labels Jul 10, 2018
@steveklabnik
Copy link
Member Author

None of these features seem actually stable yet; de-milestoning.

@steveklabnik steveklabnik added the feature-stabilized the stabilization has landed and so this is ready to go label Jul 16, 2018
@steveklabnik
Copy link
Member Author

This is supposedly stabilized.

carols10cents added a commit that referenced this issue Jan 3, 2019
I think this section needs more motivation or else it doesn't belong in
the book and should be documented somewhere else. It also appears,
according to the tracking issue, that there is more to be done, which I
think will affect best practices and how this is used in the wild.

Basically, I don't think this feature is ready for the book yet.

Reopens #1273
@carols10cents
Copy link
Member

@steveklabnik I'm removing the Anonymous Lifetime section for now (and not sending it to nostarch), and thus reopening this issue, and here's the main reason why:

  • The bit in the mini table of contents says "making elision more obvious"
  • The example shows a function with the signature fn wrap<'a>(string: &'a str) -> StrWrap<'a> and says "look, we can write fewer lifetimes by using '_ instead" which... doesn't make elision more obvious? Because the previous example doesn't have elision, it's explicit?
  • So then I looked at the edition guide, which shows that it's valid to write that function without ANY lifetime, so fn wrap(string: &str) -> StrWrap, which does use elision, and the point of this feature is to make it clearer that there is a lifetime involved without making you add an explicit lifetime
  • Which IMO means what we actually need to be motivating in this section is why you would choose to add more of what some folks see as "sigil noise" with '_ if you can just leave it off

And a secondary reason is that the tracking issue for this feature has unchecked checkboxes and isn't closed, which says to me that there's more work to be done here, the most interesting of which is "Apply to rustc, experimenting with naming conventions (e.g., working through the affect on rustc)." This feature sounds like an emerging convention that isn't ready to be codified in the book yet.

If you want to put this back in, I think we should iterate on this a bit, but I'm not going to hold up the batch of updates to the print book we're working on right now, I think we can let this go until the next batch.

@carols10cents carols10cents reopened this Jan 3, 2019
@steveklabnik
Copy link
Member Author

steveklabnik commented Jan 4, 2019 via email

@steveklabnik
Copy link
Member Author

steveklabnik commented Jan 4, 2019 via email

@carols10cents
Copy link
Member

the intent in my understanding is to lint against not including the anonymous lifetime there.

Yeah 1.31 doesn't lint for that right now, which makes me feel better about not including it at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement feature-stabilized the stabilization has landed and so this is ready to go
Projects
None yet
Development

No branches or pull requests

2 participants