diff --git a/0000-template.md b/0000-template.md index 81d2b368b6c..fce95b47900 100644 --- a/0000-template.md +++ b/0000-template.md @@ -1,52 +1,49 @@ +- Title: (fill me in with a human-focussed title for the RFC) - Feature Name: (fill me in with a unique ident, `my_awesome_feature`) - Start Date: (fill me in with today's date, YYYY-MM-DD) -- RFC PR: [rust-lang/rfcs#0000](https://github.com/rust-lang/rfcs/pull/0000) -- Rust Issue: [rust-lang/rust#0000](https://github.com/rust-lang/rust/issues/0000) +- RFC PR: [#0000](https://github.com/rust-lang/rfcs/pull/0000) +- Tracking Issue: [rust-lang/rust#0000](https://github.com/rust-lang/rust/issues/0000) +- Team: (fill me in with the team or teams responsible for this RFC) +- Keywords: (fill me in with keywords which may be useful when searching for this RFC) +- Previous RFCs: [#0000](https://github.com/rust-lang/rfcs/pull/0000) (fill me in with RFC numbers for any RFCs this RFC supersedes, deprecates, or extends) +- Previous discussion: (fill me in with links to recent previous discussions such as internals.rust-lang.org or Zulip threads, or issues. Don't worry about being complete here, you only need to include discussion which is useful context for discussing this RFC) # Summary [summary]: #summary One paragraph explanation of the feature. -# Motivation -[motivation]: #motivation +# Motivation and background +[motivation-and-background]: #motivation-and-background -Why are we doing this? What use cases does it support? What is the expected outcome? +Why are we doing this? What use cases does it support? What is the expected outcome? Why are existing solutions not good enough? If possible, include data to support your claims. Include any background context useful for understanding the RFC. -# Guide-level explanation -[guide-level-explanation]: #guide-level-explanation +# Detailed explanation +[detailed-explanation]: #detailed-explanation -Explain the proposal as if it was already included in the language and you were teaching it to another Rust programmer. That generally means: +Explain the proposal in detail. Specify the proposal as it would be experienced by a user (usually a developer using Rust) and so that it can be understood by an implementer. That generally means: - Introducing new named concepts. -- Explaining the feature largely in terms of examples. +- Explaining the feature with examples. - Explaining how Rust programmers should *think* about the feature, and how it should impact the way they use Rust. It should explain the impact as concretely as possible. - If applicable, provide sample error messages, deprecation warnings, or migration guidance. - If applicable, describe the differences between teaching this to existing Rust programmers and new Rust programmers. - -For implementation-oriented RFCs (e.g. for compiler internals), this section should focus on how compiler contributors should think about the change, and give examples of its concrete impact. For policy RFCs, this section should provide an example-driven introduction to the policy, and explain its impact in concrete terms. - -# Reference-level explanation -[reference-level-explanation]: #reference-level-explanation - -This is the technical portion of the RFC. Explain the design in sufficient detail that: - -- Its interaction with other features is clear. +- If applicable, how the feature will be taught, documented, and tested. - It is reasonably clear how the feature would be implemented. +- Its interaction with other features is clear. - Corner cases are dissected by example. -The section should return to the examples given in the previous section, and explain more fully how the detailed proposal makes those examples work. - -# Drawbacks -[drawbacks]: #drawbacks +For implementation-oriented RFCs (e.g. for compiler internals), this section should focus on how compiler contributors should think about the change, and give examples of its concrete impact. For policy RFCs, this section should provide an example-driven introduction to the policy, and explain its impact in concrete terms. -Why should we *not* do this? +# Rationale +[rationale]: #rationale -# Rationale and alternatives -[rationale-and-alternatives]: #rationale-and-alternatives +Discuss *why* your proposal is the way it is. You might want to include the following: +- What are the trade-offs, drawbacks, and risks of this design? - Why is this design the best in the space of possible designs? -- What other designs have been considered and what is the rationale for not choosing them? +- What alternative designs have been considered and what is the rationale for not choosing them? +- How does this design fit into the bigger picture? - What is the impact of not doing this? # Prior art @@ -57,7 +54,7 @@ A few examples of what this can include are: - For language, library, cargo, tools, and compiler proposals: Does this feature exist in other programming languages and what experience have their community had? - For community proposals: Is this done by some other community and what were their experiences with it? -- For other teams: What lessons can we learn from what other communities have done here? +- For other proposals: What lessons can we learn from what other communities have done here? - Papers: Are there any published papers or great posts that discuss this? If you have some relevant papers to refer to, this can serve as a more detailed theoretical background. This section is intended to encourage you as an author to think about the lessons from other languages, provide readers of your RFC with a fuller picture. @@ -69,6 +66,8 @@ Please also take into consideration that rust sometimes intentionally diverges f # Unresolved questions [unresolved-questions]: #unresolved-questions +(Optional) + - What parts of the design do you expect to resolve through the RFC process before this gets merged? - What parts of the design do you expect to resolve through the implementation of this feature before stabilization? - What related issues do you consider out of scope for this RFC that could be addressed in the future independently of the solution that comes out of this RFC? @@ -76,6 +75,8 @@ Please also take into consideration that rust sometimes intentionally diverges f # Future possibilities [future-possibilities]: #future-possibilities +(Optional) + Think about what the natural extension and evolution of your proposal would be and how it would affect the language and project as a whole in a holistic way. Try to use this section as a tool to more fully consider all possible @@ -86,9 +87,6 @@ and of the relevant sub-team. This is also a good place to "dump ideas", if they are out of scope for the RFC you are writing but otherwise related. -If you have tried and cannot think of any future possibilities, -you may simply state that you cannot think of anything. - Note that having something written down in the future-possibilities section is not a reason to accept the current or a future RFC; such notes should be in the section on motivation or rationale in this or subsequent RFCs. diff --git a/README.md b/README.md index 4e22d329248..07a3b175fc7 100644 --- a/README.md +++ b/README.md @@ -105,12 +105,13 @@ merged into the RFC repository as a markdown file. At that point the RFC is - Fork the RFC repo [RFC repository] - Copy `0000-template.md` to `text/0000-my-feature.md` (where "my-feature" is - descriptive). Don't assign an RFC number yet; This is going to be the PR - number and we'll rename the file accordingly if the RFC is accepted. + descriptive). Don't assign an RFC number yet; this is going to be the PR + number. - Fill in the RFC. Put care into the details: RFCs that do not present convincing motivation, demonstrate lack of understanding of the design's impact, or are disingenuous about the drawbacks or alternatives tend to - be poorly-received. + be poorly-received. Feel free to alter this template to make it more + appropriate for your proposal. - Submit a pull request. As a pull request the RFC will receive design feedback from the larger community, and the author should be prepared to revise it in response. diff --git a/text/0000-rfc-template.md b/text/0000-rfc-template.md new file mode 100644 index 00000000000..d9a30e6b97b --- /dev/null +++ b/text/0000-rfc-template.md @@ -0,0 +1,155 @@ +- Title: Update the RFC template +- Feature Name: N/A +- Start Date: 2022-10-28 +- RFC PR: [#0000](https://github.com/rust-lang/rfcs/pull/0000) +- Tracking Issue: N/A +- Team: core +- Keywords: process, meta, RFC +- Previous RFCs: [#6](https://github.com/rust-lang/rfcs/pull/6), [#32](https://github.com/rust-lang/rfcs/pull/32), [#1636](https://github.com/rust-lang/rfcs/pull/1636), [#2059](https://github.com/rust-lang/rfcs/pull/2059), [#2333](https://github.com/rust-lang/rfcs/pull/2333), [#2561](https://github.com/rust-lang/rfcs/pull/2561) +- Previous discussion: N/A + +# Summary +[summary]: #summary + +Improve the RFC template by adding more metadata, making the structure more flexible, and tweaking some wording. + +Note that this proposal uses the proposed template as a bootstrap example. + +# Motivation and background +[motivation-and-background]: #motivation-and-background + +Rust's RFC process has existed since before the 1.0 release and is the primary decision-making process in the community. Over time the process has evolved and we've iterated on the template used for defining RFC proposals. This RFC proposes another iteration to address some weaknesses in the current template. These weaknesses have either revealed themselves over time, or have become worse as the volume of RFCs has grown, and as RFCs have tended to become more involved. + +Concretely, + +* it is hard to search for RFCs. RFCs do not have a title and some metadata is attached to the PR rather than the document itself. When an RFC is merged that metadata is no longer directly attached to the RFC. +* RFCs are used for many purposes, not just language and standard library changes. The current template is over-specialized for language and standard library changes. +* RFCs often contain unnecessary boilerplate to conform to the template. Newcomers to the process are less confident to ignore or change the template to make the RFC more readable, and conforming to the template can be a source of friction for newcomers. +* The main part of an RFC is usually the detailed explanation. This is currently split between guide-level and reference-level sections. This is intended to focus the author on describing the proposal both for users and for implementers, and to aid in documentation of the feature. However, in practice it means that there isn't a single, self-contained description of the proposal, that parts of the description are duplicated, and that authors have to role-play as technical writers, then readers have to mentally translate back to a proposal format. Furthermore, the current template requires explanation from the perspective of the complete feature, rather than describing the change from current Rust to Rust with the proposal. Often, the latter format is more appropriate. +* RFCs often extend, supersede, or deprecate previous RFCs, and/or are based on extensive previous discussion, but this is not indicated in any uniform way. + +# Detailed explanation +[detailed-explanation]: #detailed-explanation + +See the modified [template](../0000-template.md) for the proposed template. I'll describe the changes in this section. There are also some small, miscellaneous wording changes which hopefully don't need explanation. + +### Added metadata + +I've added several metadata fields to the top of the document. These are mostly things which many RFC proposals already include, but are kept in the PR rather than the RFC text, are totally implicit, or have no tool-visible representation. + +The `title` field gives the RFC a human-oriented title which should make RFCs easier to browse, discuss, and cite. + +The `team` field duplicates the team labels from the PR. It preserves this information in the RFC document and lets the author suggest the relevant team(s). In the future, tooling could automatically populate the PR labels from this field. + +The `keywords` field lets authors specify keywords or tags. This should make RFCs easier to browse and search. Again, in the future, tooling could populate labels from this field. + +The `previous RFCs` field allows linking of RFCs. This makes explicit where an RFC replaces or extends a previous RFC, in a manner which could be interpreted by tooling. + +The `previous discussions` field allows linking of previous discussions. We encourage RFCs to be discussed elsewhere before making an RFC PR, this field allows (and encourages) keeping track of those discussions. + +### Extend motivation section to explicitly include background + +RFCs often require significant background or context to understand; there is currently nowhere in the RFC template for this. I think extending the motivation section to include background is natural and useful. + +### Merge detailed explanation sections + +I've merged 'guide-level explanation' and 'reference-level explanation' into 'detailed explanation'. + +### Simplify drawbacks, rationale, and alternatives sections + +I've changed the name of 'rationale and alternatives' to just 'rationale' and merged it with the 'drawbacks' section. Rather than having separate sections, I've suggested different kinds of rationale for this one section. This should make this part of the RFC more flexible and better adaptable for different kinds of RFC. I hope that authors will write a better rationale, focussing on what is appropriate for the RFC, rather than trying to conform to a rigid structure. + +### Mark some sections as explicitly optional + +I've added explicit text to the 'unresolved questions' and 'future possibilities' sections to make clear they are not always necessary. This should reduce boilerplate and make writing an RFC marginally more accessible. + +# Rationale +[rationale]: #rationale + +We've tried to nudge RFCs in certain directions with the structure of the RFC template. With these changes, I mostly have the same goals, but have tried to do the nudging in the text, and make the structure more flexible. I hope this leads to better RFCs and a better, more accessible experience for RFC authors. The risk here is that the nudging is less effective and RFCs get worse. If that happens we can always revert some or all of the changes, or continue to iterate (I hope we continue to iterate in any case!). I believe that the increased flexibility is worth the risk of less effective nudging. + +The downsides of the metadata changes are that it adds some boilerplate to the top of the RFC. I believe that the boilerplate is a price worth paying for having the information in a concise and tool-visible format. We might consider moving the metadata to the end of the document or to after the 'summary' section to mitigate the impact on readability. + +Some other alternatives: + +* make the changes to the metadata, but abandon the changes to the sections, +* abandon the changes to the metadata and make the changes to the sections, +* add an 'authors' or 'owners' field to the metadata. This has some benefits and some downsides, and is a change to the culture of RFCs which merits its own discussion, therefore it should be a separate RFC. +* Have subsections in the 'rationale' and/or 'detailed design' sections. I think the added complexity outweighs the benefits. +* Add some section aimed at documentation or teaching. We have tried this in the past and it has not been successful. I think encouraging thinking about documentation and teaching in the prose is a better approach. +* Make the 'background' section separate from 'motivation'. The two topics are often linked and I think the more flexible structure is better. + +I would like to see some bigger changes to the RFC process. I don't think that the proposed changes make any larger changes more difficult, they are just an incremental improvement on the current situation. + +# Prior art +[prior-art]: #prior-art + +## Other languages' processes + +Many languages and projects have some formal process for making changes and their needs are often quite different from Rust's. I'll cover a few examples here: + +### Python + +Python uses the PEP. It doesn't have a template for proposals, but it does have a list of [suggested sections](https://peps.python.org/pep-0012/#suggested-sections) which is effectively the same. The sections are very much a suggestion and it is culturally acceptable for PEPs to have a different format. The first few sections are: + +* abstract, +* motivation, +* rationale, +* specification, + +which closely match what is proposed here (albeit with different names). There are also sections on backwards compatibility, security, etc. which Rust RFCs usually expect to be in the detailed design section(s). They do have a 'how to teach this' section, see some discussion in the rationale section and below. + +### Javascript + +Javascript is evolved through the TC39 committee. Proposals are a repository rather than a PR. There is a [template](https://github.com/tc39/template-for-proposals) for the repository, but the different style of process and format means it is not directly comparable to Rust's. The [How to write a good explainer](https://github.com/tc39/how-we-work/blob/HEAD/explainer.md) is closer. It is phrased as a suggestion rather than a mandatory structure. The sections are: + +* status (including authors), +* motivation, +* use cases, +* description, +* comparison (analogous to 'prior art' in Rust RFCs), +* implementations, +* Q&A. + +In Rust RFCs, status is part of the PR metadata rather than the RFC text. Since the PR is primary until the RFC is accepted, there is no point in adding this to the metadata. We might consider having an 'authors' field, but this would be a big change to the culture of Rust RFCs, so is out of scope here. + +I believe the level of granularity here matches this proposal, with some different choices which are due to cultural and technical context. + +### F# + +The F# RFC process is similar to Rust's RFC process and has a similar [template](https://github.com/fsharp/fslang-design/blob/main/RFC_template.md). It's sections are: + +* summary, +* motivation, +* detailed design, +* drawbacks, +* alternatives, +* compatibility, +* pragmatics (diagnostics, tooling, performance, scaling, culture-aware formatting/parsing), +* unresolved questions. + +The first few sections and the last are similar to in this proposal. They have separate 'drawbacks' and 'alternatives' sections. In Rust, 'compatibility' is usually included in the 'detailed design' sections, and this seems to work well for us. The 'pragmatics' section is an interesting factoring and is worth considering for future work. I think it will take some work to choose appropriate sub-sections for Rust because our RFCs have broader use than in F#. + +### Ember + +Ember's RFC process was strongly influenced by Rust's and there has been much cross-pollination over the years. Their [template](https://github.com/emberjs/rfcs/blob/master/0000-template.md) is similar to earlier iterations of Rust's template. + +## History of the RFC template + +The RFC template has always been part of the RFC process but has changed over time. The major changes (and the RFC PR which proposed those change) are: + +* #6: initial template (though actually it existed in the repo before the PR because this was the wild-west age of the RFCs repo), +* #32: adds a 'drawbacks' section, +* #1636: adds a "How do we teach this?" section; the motivation was primarily to encourage authors to think about documentation, +* #2059: changes the 'detailed design' and 'how do we teach this' sections into 'guide-level explanation' and 'reference-level explanation' sections; expands 'alternatives' to 'rationale and alternatives'. The motivation was to make the process more accessible, and because there was a feeling that the 'how do we teach this' section was not having the desired effect, in part because it was interpreted as describing the mechanism for teaching, rather than the details of describing the feature to users who have not encountered it before. +* #2333: adds a 'prior art' section, +* #2561: adds a 'future possibilities' section. + +My impression is that the guide-level/reference-level split has not worked out for us. Although it has had some benefits in thinking about the way new features are documented, these are outweighed by the drawbacks (discussed above). Adding sections for drawbacks, alternatives, and rationale have all been beneficial, but with the benefit of hindsight, these would be better as one section rather than three. Although no one change is responsible, we can see that the effect of the evolution over time has led to the RFC template having many fine-grained sections. + +# Future possibilities +[future-possibilities]: #future-possibilities + +As mentioned earlier, part of the rationale for these changes is to make RFCs easier for tools to interpret. I hope that in the future we can have improved tooling for submitting RFCs, and for reading and searching RFCs. + +I believe the RFC process as a whole needs improvement (see [blog post](https://ncameron.org/blog/the-problem-with-rfcs/)), however, I don't have concrete suggestions at this time, and such changes are beyond the scope of this proposal.