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
Copy file name to clipboardExpand all lines: text/0544-rename-int-uint.md
+27-3Lines changed: 27 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -46,18 +46,42 @@ However, given the discussions about the previous revisions of this RFC, and the
46
46
47
47
# Detailed Design
48
48
49
-
- Rename `int/uint` to `isize/usize`, with `is/us` being their literal suffixes, respectively.
49
+
- Rename `int/uint` to `isize/usize`, with `isz/usz` being their literal suffixes, respectively.
50
50
- Update code and documentation to use pointer-sized integers more narrowly for their intended purposes. Provide a deprecation period to carry out these updates.
51
51
52
-
Some would prefer using `isize/usize` directly as literal suffixes here, as `is/us` are actual words and maybe a bit *too* pleasant to use. But on the other hand, `42isize` can be too long for others.
52
+
There are different opinions about which literal suffixes to use. The following section would discuss the alternatives.
53
+
54
+
## Choosing literal suffixes:
55
+
56
+
### `isize/usize`:
57
+
58
+
* Pros: They are the same as the type names, very consistent with the rest of the integer primitives.
59
+
* Cons: They are too long for some, and may stand out too much as suffixes.
60
+
61
+
### `is/us`:
62
+
63
+
* Pros: They are succinct as suffixes.
64
+
* Cons: They make an extra pair of reserved words which are actual English words, with `is` being a keyword in many programming languages and `us` being an abbreviation of "microsecond", which makes them confusing as suffixes, though technically there should be no ambiguities between "`is` the suffix" and "`is` the keyword with other use cases (in the future)". Also, `is/us` may be *too* short (shorter than `i64/u64`) and may be *too* pleasant to use, which can be a problem.
65
+
66
+
### `isz/usz`:
67
+
68
+
* Pros: They are the middle grounds between `isize/usize` and `is/us`, neither too long nor too short, and they are not actual English words.
69
+
* Cons: An extra pair of reserved words.
70
+
71
+
### `iz/uz`:
72
+
* Pros and cons: Similar to those of `is/us`, except that `iz/uz` are not actual words, which is an additional advantage. However it may not be immediately clear that `iz/uz` are abbreviations of `isize/usize`.
73
+
74
+
This author believes that `isz/usz` are the best choices here.
75
+
76
+
(Note: Even if `is/us` don't get used as literal suffixes, it can be beneficial to reserve `is`, but this is outside the scope of this RFC.)
0 commit comments