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

subtask of RFC 195: implement associated lifetimes #17842

Closed
pnkfelix opened this Issue Oct 7, 2014 · 17 comments

Comments

Projects
None yet
7 participants
@pnkfelix
Copy link
Member

pnkfelix commented Oct 7, 2014

As a subtask of #17307, we want to implement associated lifetimes at some point.

This blocks the code revisions implied by #17828.

@aturon notes here that this may block 1.0; or at least, we certainly cannot mark libraries associated with #17828 as stable, so the real question is whether such library types need to be stable for 1.0.

@alexcrichton alexcrichton referenced this issue Oct 7, 2014

Closed

Implement associated items #17307

23 of 26 tasks complete

@aturon aturon added the I-nominated label Oct 9, 2014

@aturon

This comment has been minimized.

Copy link
Member

aturon commented Oct 9, 2014

To be clear, there's a P-backcompat-lang issue here: the design intends that lifetimes cannot be used in input position, only in output (associated item) position.

The rationale is that the arguments to a trait are used to drive dispatch; each different set of instantiations can provide a distinct implementation for the same Self type (as if they were different traits). But selecting an impl on the basis of a lifetime doesn't make any sense.

I would say this is P-backcompat-lang, but not necessarily 1.0 -- but we should discuss.

@pnkfelix

This comment has been minimized.

Copy link
Member Author

pnkfelix commented Oct 9, 2014

Assigning P-high, not 1.0.

@pnkfelix pnkfelix added P-medium and removed I-nominated labels Oct 9, 2014

@japaric

This comment has been minimized.

Copy link
Member

japaric commented Oct 14, 2014

Assigning P-high, not 1.0.

Shouldn't we at least reserve the lifetime keyword before 1.0?

@apasel422

This comment has been minimized.

Copy link
Member

apasel422 commented Jul 24, 2015

Is there any plan to move forward on this? It doesn't appear that the lifetime keyword was reserved.

@aturon

This comment has been minimized.

Copy link
Member

aturon commented Jul 27, 2015

@apasel422 I don't know of any concrete plans, though a PR would be welcome.

In terms of keyword reservation, this can likely be handled via "contextual keywords".

@apasel422

This comment has been minimized.

Copy link
Member

apasel422 commented Jul 27, 2015

@aturon Thanks. Do you know how associated lifetimes will be referenced? The RFC doesn't appear to depict that syntax.

trait Foo {
    lifetime b; // or is this supposed to be `lifetime 'b;`?
    fn foo(&'Self::b self); // unsure if this is correct
}
@aturon

This comment has been minimized.

Copy link
Member

aturon commented Jul 27, 2015

@apasel422 You're right -- the RFC is incomplete on these points. I suspect we'd want a ' in both locations. Probably any implementation should be paired with an amendment to the RFC detailing this syntax (which can then be approved via the normal community process).

@apasel422

This comment has been minimized.

Copy link
Member

apasel422 commented Jul 27, 2015

By the way, this issue should be renamed to "subtask of RFC 195", not 59.

@pnkfelix pnkfelix changed the title subtask of RFC 59: implement associated lifetimes subtask of RFC 195: implement associated lifetimes Mar 25, 2016

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Oct 20, 2016

Is this ever going to happen? P-low? Should this be B-RFC-approved to indicate that it's for completion of an RFC?

@nikomatsakis nikomatsakis added T-lang and removed T-compiler labels Oct 20, 2016

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 20, 2016

Switching over to lang team; my feeling is that I'd like this to happen, but I also sort of feel like a fresh RFC might be a good idea. Certainly I want this regularly when I have some "meta-parameterization" that is just a bundle of associated types (e.g., trait GraphTypes { type Node; type Edge; ... }, and everything has <G: GraphTypes> so they can name G::Node etc.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 20, 2016

I know @pnkfelix and I have also talked about uses for this.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 20, 2016

Anyway, P-low for sure.

triage: P-low

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 20, 2016

But I'll leave as nominated to discuss question of whether to have a new RFC.

@aturon

This comment has been minimized.

Copy link
Member

aturon commented Oct 22, 2016

@nikomatsakis Why do you think a fresh RFC is needed? Offhand it doesn't seem like there's a ton of wiggle room in the design space; the feature has just never been high enough priority to bother implementing it.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 25, 2016

@aturon well, for example, the existing RFC gives zero examples of using an associated lifetime; based on a quick read, I didn't see an obvious syntax for how you name such a lifetime (is it &T::'x Foo? &'T::x Foo?). There seem to be parsing implications that are probably fine but I haven't fully thought through... (is it ok that we don't know if this is a path that leads to a lifetime until later? probably, but it makes the grammar quite a bit more complex I guess)

@aturon

This comment has been minimized.

Copy link
Member

aturon commented Oct 25, 2016

@nikomatsakis Got it, thanks.

Given those gaps, I'd be fine closing this out and requiring a fresh RFC to flesh it out and motivate it more substantially.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Nov 3, 2016

Closing because it needs an RFC.

@SoniEx2 SoniEx2 referenced this issue Jun 11, 2017

Open

Heads. #322

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.