Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRFC: Reserve `delegate` as a keyword in edition 2018 #2429
Conversation
Centril
added
the
T-lang
label
May 3, 2018
This comment has been minimized.
This comment has been minimized.
|
Maybe this has been bike-shedded in #2393, but if this is being proposed as a standalone RFC, it's probably worth bringing up here. |
This comment has been minimized.
This comment has been minimized.
|
@varkor I agree and share your concern, both on that The best synonyms I could think of are:
but they are not that great. The longest keyword we have right now is |
This comment has been minimized.
This comment has been minimized.
One possibility is simply contracting, e.g.
Yeah, |
This comment has been minimized.
This comment has been minimized.
|
This seems reasonable to me. |
This comment has been minimized.
This comment has been minimized.
|
@varkor Not a fan of Attempting a semi-rigorous motivation: We have a few used keywords that are contractions.
Meanwhile, my prediction is that In conclusion, it seems to me that the loss to readability is larger than is made up by improved writing ergonomics. Weighing readability vs. writability, I think we should say that writing ergonomics is something like half as important (hard to quantify, but you get the idea?) as readability. Therefore, I think |
This comment has been minimized.
This comment has been minimized.
|
I'm fine with reserving -- my only hesitation, though, is that |
This comment has been minimized.
This comment has been minimized.
|
We discussed this in the lang team meeting, and agreed to reserve @rfcbot fcp merge |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
May 3, 2018
•
|
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged teams: Concerns:
Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
rfcbot
added
proposed-final-comment-period
disposition-merge
labels
May 3, 2018
Centril
referenced this pull request
May 4, 2018
Open
Rust Structure and Implementation "Embedding" Brainstorm #2431
This comment has been minimized.
This comment has been minimized.
I think that's an acceptable tradeoff ā the concept of delegation is already about (a type of) compression, so having a slightly longer word is ok to me. One possible "rescue" is that some potential usage might be closer to how
|
rfcbot
added
proposed-final-comment-period
disposition-merge
labels
May 8, 2018
This comment has been minimized.
This comment has been minimized.
|
@rfcbot concern value I'm unsure of the value of this. Given that delegate is both a common design pattern (from the GoF book) and idiom, I would expect it to be relatively widely used as an identifier. So the cost to reserving it seems high. Given that in we will almost certainly be able to use a contextual keyword, that delegate is not a great keyword because of its length, and that I'm not at all convinced we need delegation in the language, I think this is a pretty low value (reward/risk) reservation. |
rfcbot
added
proposed-final-comment-period
disposition-merge
labels
May 8, 2018
This comment has been minimized.
This comment has been minimized.
Why guess?
If more data is needed we can reserve the keyword in a PR on edition 2015 and then crater run it.
Sure; but a policy was adopted. ;) is this case particular?
This surprises me; I think it is well motivated feature and a problem for many, as evidenced by it being brought up frequently: |
This comment has been minimized.
This comment has been minimized.
|
There's also the fact that making this a keyword requires us to gate any delegation on the 2018 edition. I don't see a reason not to support new features on the old edition unless it makes it substantially more difficult. delegate is used in a position in which we already have contextual keywords ( |
This comment has been minimized.
This comment has been minimized.
Does it? Can't it be a contextual keyword in 2015 and enhanced to a full keyword in 2018? |
This comment has been minimized.
This comment has been minimized.
The sourcegraph query only search for item declarations, which I don't think is a good metric. You may declare An upper limit query gives 298/400 search results (including comments and strings), which is far from minimal even if you discount this by 50%. |
This comment has been minimized.
This comment has been minimized.
I was mostly concerned with breaking public APIs; internal uses should be considered less problematic because it has less of a chain-effect, so it seems to me not a bad metric in that respect. Here's a query looking for
|
rfcbot
added
proposed-final-comment-period
disposition-merge
labels
May 17, 2018
This comment has been minimized.
This comment has been minimized.
This is still an element of user pain which we should avoid if possible.
aiui, that applies to actual features which are in the process of being designed and implemented, not a general policy that we should reserve every keyword which might someday be useful.
I disagree that it is well-motivated, but even assuming there is good motivation there is no consensus at all on what a solution looks like or even if a solution will require a keyword. There are plenty of features around which have had discussion and a few RFCs, but I don't think we want to reserve keywords for all of them, and I don't see why delegation is special here. |
This comment has been minimized.
This comment has been minimized.
repax
commented
May 23, 2018
|
To what extent has using existing keywords instead been discussed? I only found these snippets under Alternatives:
Examples off the top of my head: use self.x as y;
use impl self.x for y;
impl y as self.x;
... |
This comment has been minimized.
This comment has been minimized.
|
In past iterations of delegation proposals, But I think that's the only existing keyword that got suggested enough to be properly discussed. afaik |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Boscop
commented
Jun 13, 2018
•
|
@shepmaster People could easily find the meaning of the keyword through google, because the docs about the Or the other direction: Someone sees the Also the argument that other languages don't use this keyword doesn't really count IMO. Other languages also don't have many of the other keywords that Rust has. And I don't know any languages that use @Centril I know about the |
This comment has been minimized.
This comment has been minimized.
|
I think
I've discussed this here: #2429 (comment)
C# does. https://github.com/Centril/rfcs/blob/rfc/reserve-delegate/text/0000-reserve-delegate.md#prior-art |
This comment has been minimized.
This comment has been minimized.
Boscop
commented
Jun 13, 2018
•
|
@Centril But in C# Also, please consider my other points I made at the top here (they also apply even if I think delegation / proxying will be used a lot (at least in my projects) so it should have a shorter keyword. And But if we won't end up using |
This comment has been minimized.
This comment has been minimized.
repax
commented
Jun 14, 2018
•
Now consider this statement: impl TR for S {
delegate * to self.f;
}Clearly, impl TR for S {
use self.f as proxy for *;
}and that's hardly any shorter. And even that doesn't feel quite accurate: |
This comment has been minimized.
This comment has been minimized.
Boscop
commented
Jun 14, 2018
|
@repax
|
This comment has been minimized.
This comment has been minimized.
|
I googled a bit:
However, I think "proxy foo to self's bar" does not sound natural while "delegate foo to self's bar" does. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Jun 15, 2018
|
@joshtriplett proposal cancelled. |
rfcbot
removed
proposed-final-comment-period
disposition-merge
labels
Jun 15, 2018
This comment has been minimized.
This comment has been minimized.
|
@rfcbot fcp close |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Jun 15, 2018
•
|
Team member @joshtriplett has proposed to close this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
rfcbot
added
proposed-final-comment-period
disposition-close
labels
Jun 15, 2018
This comment has been minimized.
This comment has been minimized.
elahn
commented
Jun 15, 2018
|
@joshtriplett is the modified keyword policy you're referring to published somewhere? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
TL;DR ā the policy doesn't really impact delegation as a feature, just whether or not we'd reserve a keyword in the hopes of the feature being implemented. |
rfcbot
added
final-comment-period
and removed
proposed-final-comment-period
labels
Jun 22, 2018
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Jun 22, 2018
|
|
rfcbot
added
finished-final-comment-period
and removed
final-comment-period
labels
Jul 2, 2018
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Jul 2, 2018
|
The final comment period, with a disposition to close, as per the review above, is now complete. By the power vested in me by Rust, I hereby close this RFC. |
rfcbot
added
closed
and removed
disposition-close
labels
Jul 2, 2018
rfcbot
closed this
Jul 2, 2018
Centril
referenced this pull request
Jul 13, 2018
Merged
eRFC: if- and while-let-chains, take 2 #2497
This comment has been minimized.
This comment has been minimized.
Boscop
commented
Jul 23, 2018
•
It doesn't have to be readable verbatim like a grammatically correct English sentence. So could we also reserve |
Centril commentedMay 3, 2018
The keyword
delegateis reserved in edition 2018 and beyond.This RFC only aims to reserve
delegatefor possible future use so that we have options.For the (current) main delegation proposal, please see #2393.
All credit goes to the authors of RFC #2393!