Skip to content

Reserve more numeric types. #907

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

Closed
wants to merge 2 commits into from
Closed
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
33 changes: 33 additions & 0 deletions text/0000-reserve-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- Start Date: 2014-06-25
- RFC PR #: (leave this empty)
- Rust Issue #: (leave this empty)

# Summary

Reserve more numeric types.

# Motivation

It is conceivable that Rust will gain support for types such as `f128`, `f16`,
or `u128`. In the interest of backwards compatability, extend the grammar to
reserve these.

Adding them is backwards incompatible because `type PRIMITIVE = T;` is an error.

# Detailed design

Reserve the following type names: `fN`, `uN`, `iN` for `N` a multiple of 8.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What limit? Or just to, say, 232?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever the parser can handle.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parser can handle arbitrarily large numbers: congruence mod 8 can be determined using only the last 3 digits of a number represented in base 10, meaning string handling works fine, and hence i1234567891234567891234567891234567800 could be checked to be "valid" under that rule.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to limit ourselves to numbers that are a multiple of 8? Why not just reserve them for all numbers?


Reserve additionally `dN` for decimal floating point numbers.

Reserve additionally `mN` for SSE.

# Drawbacks

Makes the grammar larger for types which we may never use.

# Alternatives

New types could require a flag to be enabled.

C99 uses `_Bool` instead of `bool` because `_T` is reserved.