You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm proposing to use k#-prefixed identifiers (such as k#keyword) as keywords in language experiments in a permanently-unstable-until-otherwise-decided fashion. Prefixed identifiers have already been reserved in editions 2021+ by rust-lang/rfcs#3101 but to my knowledge there's no accepted precedent yet for using them in experimental syntax. rust-lang/rfcs#3098 proposes to stabilize the k# prefix as a way to write edition-gated keywords in older editions, but discussion on the RFC has stalled out. I believe having an easy way to introduce experimental keywords for unstable features is useful enough to stand on its own, but this proposal is meant to be future-compatible with the RFC: if it's is later accepted, that opens up stabilization for k# keywords; otherwise, they remain a tool for experimenting with unstable features.
Currently, the alternative options for experimenting with keyword syntax are fairly limited. To my understanding, they're roughly:
Reserve a keyword for use in future editions. Having a future edition (add a "future" edition rust#137606) helps in that it means we technically wouldn't have to commit to stabilizing reservations, but from what I can tell at least, the future edition is meant as a staging ground for edition migrations rather than as a sandbox for lang experiments.
Combine a new unreserved keyword with an existing reserved keyword, e.g. as is done by do yeet. This isn't ideal when none of the existing reserved keywords fit the spirit of the experiment.
Define a built-in macro or a macro wrapper around builtin# syntax (Add builtin# for compiler-intrinsic syntax #580), e.g. as is done by deref!. This is great for prototyping, but not for testing how a feature feels to use.
For experiments where we want to determine the ergonomics of a potential new feature, it's important to minimize the amount of syntactic baggage. An example of this is the proposed is operator (rust-lang/rfcs#3573): as syntactic sugar, there's a large difference between testing expr k#is pat and the equivalent achievable with a macro, is!(expr is pat).
Proposal
I'm proposing to use
k#-prefixed identifiers (such ask#keyword) as keywords in language experiments in a permanently-unstable-until-otherwise-decided fashion. Prefixed identifiers have already been reserved in editions 2021+ by rust-lang/rfcs#3101 but to my knowledge there's no accepted precedent yet for using them in experimental syntax. rust-lang/rfcs#3098 proposes to stabilize thek#prefix as a way to write edition-gated keywords in older editions, but discussion on the RFC has stalled out. I believe having an easy way to introduce experimental keywords for unstable features is useful enough to stand on its own, but this proposal is meant to be future-compatible with the RFC: if it's is later accepted, that opens up stabilization fork#keywords; otherwise, they remain a tool for experimenting with unstable features.Currently, the alternative options for experimenting with keyword syntax are fairly limited. To my understanding, they're roughly:
futureedition (add a "future" edition rust#137606) helps in that it means we technically wouldn't have to commit to stabilizing reservations, but from what I can tell at least, thefutureedition is meant as a staging ground for edition migrations rather than as a sandbox for lang experiments.do yeet. This isn't ideal when none of the existing reserved keywords fit the spirit of the experiment.builtin#syntax (Add builtin# for compiler-intrinsic syntax #580), e.g. as is done byderef!. This is great for prototyping, but not for testing how a feature feels to use.For experiments where we want to determine the ergonomics of a potential new feature, it's important to minimize the amount of syntactic baggage. An example of this is the proposed
isoperator (rust-lang/rfcs#3573): as syntactic sugar, there's a large difference between testingexpr k#is patand the equivalent achievable with a macro,is!(expr is pat).Mentors or Reviewers
Process
The main points of the Major Change Process are as follows:
@rustbot secondor kickoff a team FCP with@rfcbot fcp $RESOLUTION.You can read more about Major Change Proposals on forge.