Skip to content

Replace be with become #601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 10, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions text/0000-be2become.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
- 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 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