Skip to content
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

RFC: Rename int/uint to something better #544

Merged
merged 20 commits into from
Jan 6, 2015
Merged
Changes from 1 commit
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
Prev Previous commit
Fixed capitalization and one incorrect adjective.
  • Loading branch information
CloudiDust committed Jan 6, 2015
commit 777aef180253f9f66a3cd51a95b78096dbc73023
8 changes: 4 additions & 4 deletions text/0000-rename-int-uint.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ See **Alternatives B to L** for the other alternatives that are rejected.

## Drawbacks of `isize/usize`:

- the names fail to indicate the precise semantics of the types - *pointer-sized integers*. (And they don't follow the `i32/u32` pattern as faithfully as possible, as `32` indicates the exact size of the types, but `size` in `isize/usize` is vague in this aspect.)
- the names favour some of the types' use cases over the others.
- the names remind people of C's `ssize_t/size_t`, but `isize/usize` don't share the exact same semantics with the C types.
- The names fail to indicate the precise semantics of the types - *pointer-sized integers*. (And they don't follow the `i32/u32` pattern as faithfully as possible, as `32` indicates the exact size of the types, but `size` in `isize/usize` is vague in this aspect.)
- The names favour some of the types' use cases over the others.
- The names remind people of C's `ssize_t/size_t`, but `isize/usize` don't share the exact same semantics with the C types.

Familiarity is a double edged sword here. `isize/usize` are chosen not because they are perfect, but because they represent a good compromise between semantic accuracy, familiarity and code readability. Given good documentation, the drawbacks listed here may not matter much in practice, and the combined familiarity and readability advantage outweighs them all.

Expand Down Expand Up @@ -191,7 +191,7 @@ fn slice_or_fail<'b>(&'b self, from: &uptrsz, to: &uptrsz) -> &'b [T]

## K. `ipsz/upsz`:

Now (and only now, which is the problem) it is clear where this final pair of alternatives comes from.
Now (and only now, which is the problem) it is clear where this pair of alternatives comes from.

By shortening `ptr` to `p`, `ipsz/upsz` no longer stress the "pointer" parts in anyway. Instead, the `sz` or "size" parts are (comparatively) stressed. Interestingly, `ipsz/upsz` look similar to `isiz/usiz`.

Expand Down