Allow using Self in impls
This is convenient because it allows you to copy-paste trait declarations.
Fully back-compat, certainly not a 1.0 priority.
emberian at 2014-02-27 15:53:14
This would essentially involve adding a "hidden" type parameter in every impl.
emberian at 2014-02-27 15:54:30
cc @nikomatsakis @pnkfelix
emberian at 2014-02-27 15:54:44
Is there really a need for another magic type parameter? I would think
astconvcan resolveSelfinimpls to the actual type, and nothing needs to seety_self.Eduard-Mihai Burtescu at 2014-02-27 20:30:16
Sure that could work
On Thu, Feb 27, 2014 at 3:30 PM, Eduard Burtescu notifications@github.comwrote:
Is there really a need for another magic type parameter? I would think astconv can resolve Self in impls to the actual type, and nothing needs to see ty_self.
— Reply to this email directly or view it on GitHubhttps://github.com/mozilla/rust/issues/12600#issuecomment-36287579 .
emberian at 2014-02-27 20:48:53
As @eddyb said, I think this is basically syntactic sugar, and I have no particular problem with it. I think the main reason not to do it (and the reason we didn't before) is so as not to obscure the role of
Selfas a type parameter and so on, which isn't applicable to impls, but I don't know that it really matters.Niko Matsakis at 2014-02-28 10:38:39
+1 to all of what Niko said. In particular, I do like the sugar being suggested here. But at the same time, I noticed that in a recent rust-dev post, @anasazi used the notation
Self<T>to apply a hypothetical higher-kindedSelf : * -> *to a type parameter. If we wanted to leave such options open for the future, it may constrains how we use/abuseSelfnow. (But as niko said, the role ofSelfin trait definitions may not be relevant to its role in impls.)Felix S Klock II at 2014-02-28 11:44:33
This should probably go through the new RFC process. @cmr are you going to submit one? Can we close this issue?
Flavio Percoco at 2014-03-24 23:09:58
I suppose I can write one later this week.
emberian at 2014-03-24 23:48:36
On Mon, Mar 24, 2014 at 04:10:00PM -0700, Flavio Percoco Premoli wrote:
This should probably go through the new RFC process. @cmr are you going to submit an one? Can we close this issue?
Agreed
Niko Matsakis at 2014-03-26 10:14:49
This issue has been moved to the RFCs repo: rust-lang/rfcs#310
Rust highfive robot at 2014-09-24 05:00:37