From 2a4b7d29d6592d2c0806f7d6b12a2e9fe6191502 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Tue, 20 Jan 2015 16:40:48 +0100 Subject: [PATCH 1/2] Replace `be` with `become` --- text/0000-be2become.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 text/0000-be2become.md diff --git a/text/0000-be2become.md b/text/0000-be2become.md new file mode 100644 index 00000000000..2194afed540 --- /dev/null +++ b/text/0000-be2become.md @@ -0,0 +1,35 @@ +- Start Date: 2015-01-20 +- RFC PR: (leave this empty) +- Rust Issue: (leave this empty) + +# Summary + +Rename the `be` reserved keyword to `become`. + +# Motivation + +A keyword needs to be reserved to support guaranteed tail calls in a backward-compatible way. Currently the keyword reserved for this purpose is `be`, but the `become` alternative was proposed in +the old [RFC](https://github.com/rust-lang/rfcs/pull/81) for guaranteed tail calls, which is now postponed and tracked in [PR#271](https://github.com/rust-lang/rfcs/issues/271). + +Some advantages of the `become` keyword are: + - it provides a clearer indication of its meaning ("this function becomes that function") + - its syntax results in better code alignment (`become` is exactly as long as `return`) + +The expected result is that users will be unable to use `become` as identifier, ensuring that it will be available for future language extensions. + +This RFC is not about implementing tail call elimination, only on whether the `be` keyword should be replaced with `become`. + +# Detailed design + +Rename the `be` reserved word to `become`. This is a very simple find-and-replace. + +# Drawbacks + +Some code might be using `become` as an identifier. + +# Alternatives + +The main alternative is to keep the `be` keyword reserved for supporting guaranteed tail calls in a backward-compatible way. Using `become` as the keyword for tail calls would not be backward-compatible because it would introduce a new keyword, which might have been used in valid code. + +# Unresolved questions + From 926fbe3c33ff4c56431dc5a69e2a14f7edc3694a Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Tue, 20 Jan 2015 23:41:10 +0100 Subject: [PATCH 2/2] Extend alternatives As suggested by Steve Klabnik, we can also have both `be` and `become` as reserved keywords. --- text/0000-be2become.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/text/0000-be2become.md b/text/0000-be2become.md index 2194afed540..7d45f327ceb 100644 --- a/text/0000-be2become.md +++ b/text/0000-be2become.md @@ -29,7 +29,9 @@ Some code might be using `become` as an identifier. # Alternatives -The main alternative is to keep the `be` keyword reserved for supporting guaranteed tail calls in a backward-compatible way. Using `become` as the keyword for tail calls would not be backward-compatible because it would introduce a new keyword, which might have been used in valid code. +The main alternative is to do nothing, i.e. to keep the `be` keyword reserved for supporting guaranteed tail calls in a backward-compatible way. Using `become` as the keyword for tail calls would not be backward-compatible because it would introduce a new keyword, which might have been used in valid code. + +Another option is to add the `become` keyword, without removing `be`. This would have the same drawbacks as the current proposal (might break existing code), but it would also guarantee that the `become` keyword is available in the future. # Unresolved questions