Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAmend RFC 544: Use `isize/usize` as the literal suffixes for themselves #573
Conversation
This comment has been minimized.
This comment has been minimized.
|
Point of clarification: Can you clarify what the RFC is referring to when it says that "isz" and "usz" would become additional "reserved words"? We're about literal suffixes here, right? That does not require them to be keywords or otherwise reserved, as far as I know. |
This comment has been minimized.
This comment has been minimized.
|
+1 from me, unsurprisingly. |
This comment has been minimized.
This comment has been minimized.
|
I prefer the extremes: |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis, I am under this impression because @cmr commented in #544:
|
This comment has been minimized.
This comment has been minimized.
|
@tshepang, some would find |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis, and on second thought, I'll update this PR tonight (local time). |
This comment has been minimized.
This comment has been minimized.
|
@CloudiDust I took that to mean that all literal suffixes in general are reserved, meaning that it is invalid to put anything other than an existing suffix after a literal, making it possible to add new suffixes later without it being a breaking change. |
This comment has been minimized.
This comment has been minimized.
|
@rkjnsn, yeah this is also my understanding now. I forgot about |
This comment has been minimized.
This comment has been minimized.
|
I'll also note that I'd be fine with |
This comment has been minimized.
This comment has been minimized.
winksaville
commented
Jan 13, 2015
|
+1 for isz/usz |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@CloudiDust I didn't mean that suffixes in use needed to be reserved words, merely that all integer suffixes are already reserved. |
This comment has been minimized.
This comment has been minimized.
|
-1, too ugly |
This comment has been minimized.
This comment has been minimized.
|
@liigo, then what about |
CloudiDust
referenced this pull request
Jan 13, 2015
Merged
RFC: Rename `int/uint` to something better #544
This comment has been minimized.
This comment has been minimized.
alfiedotwtf
commented
Jan 13, 2015
|
+1 to @rkjnsn We probably want symmetry with the datatype themselves rather than introducing more names. |
This comment has been minimized.
This comment has been minimized.
1fish2
commented
Jan 14, 2015
|
To suggest a lightweight empirical approach: Step 1. Finish converting misuses of Step 2. Pick a frequency metric for these literal suffixes, e.g. the % of source files in the library where they appear. Or the % of non-blank, non-comment source lines in the library where they appear. Or the % of integer literals that use these suffixes. Pick high and low bounds, say, 30% and 70% of source files. Step 3. Grep the library to measure this frequency. If usage is below the low bound, then it's not worth documenting/teaching/remembering/searching/hassling shorthand terms like Step 4. If shorthand terms may be worth the costs, do a small experiment to see which of |
This comment has been minimized.
This comment has been minimized.
|
I did suggest ed isize/usize, in your original int/uint rename RFC, but you
|
This comment has been minimized.
This comment has been minimized.
|
@1fish2, this can be a fine method if time/resource permits. @liigo, eh, sorry it seems that you didn't comment about the But yes in #544, Now IMHO |
This comment has been minimized.
This comment has been minimized.
|
Also,
Eh, 42 is what? While |
This comment has been minimized.
This comment has been minimized.
alfiedotwtf
commented
Jan 19, 2015
|
Just a note - I'm feeling more and more comfortable with is/us as the days go by. |
This comment has been minimized.
This comment has been minimized.
|
-1 |
This comment has been minimized.
This comment has been minimized.
UtherII
commented
Jan 20, 2015
|
+1 for isz/usz |
This comment has been minimized.
This comment has been minimized.
archer884
commented
Jan 20, 2015
|
-1 Not a fan of isz or usz because I hit s and z with the same finger and that's really disruptive. :( Edit: was looking at some of the other options proposed (when? dunno). Would totally be ok with uz/iz. I know it doesn't necessarily follow as an abbreviation, but I'm used to that (n as abbrev for "decimal," for example). |
This comment has been minimized.
This comment has been minimized.
phaux
commented
Jan 21, 2015
|
How about the signed integer becoming just |
This comment has been minimized.
This comment has been minimized.
zonyitoo
commented
Jan 22, 2015
|
Using let val1: iz = 42;
let val2 = 42iz;
let val3: uz = 42;
let val4 = 42uz; |
nrc
assigned
nikomatsakis
Jan 22, 2015
This comment has been minimized.
This comment has been minimized.
|
( |
This comment has been minimized.
This comment has been minimized.
chrish42
commented
Jan 26, 2015
|
+1 for "isz" and "usz", because "sz" is a pretty clear abbreviation for "size", so they're clear and succinct in my opinion. But all the other alternatives are better than "is" and "us", in my opinion, which I can't help but read as the verb "is" and the abbreviation for microsecond, like a bunch of other people. |
This comment has been minimized.
This comment has been minimized.
|
Admitting another bikeshed, |
This comment has been minimized.
This comment has been minimized.
|
If this isn't done by Beta, will we be stuck with |
This comment has been minimized.
This comment has been minimized.
|
@tshepang, I am not sure. It seems to me that there are still a fair amount of breaking changes happening, so I'm wondering if the beta should be postponed or if an alpha2 is preferable to a beta1. No matter what the next release is called, if it is going out next week, then I don't expect "non-critical" breaking changes to cease. |
This comment has been minimized.
This comment has been minimized.
|
I feel the rush for Alpha (Jan 09) was rather frantic, where people made decisions with not enough discussion/feedback. I'd rather this be avoided in future, so I think next week's release should be another Alpha, not a Beta. |
This comment has been minimized.
This comment has been minimized.
|
An alternative is to support type ascription, then just use type ascription where necessary and get rid of numeric suffixes. |
This comment has been minimized.
This comment has been minimized.
|
@nick29581, yeah I just read that RFC and I prefer that now. Let's get rid of the suffixes. |
This comment has been minimized.
This comment has been minimized.
|
Funny that I was just thinking about making a comment here to suggest type ascription and Nick beat me to it. :) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Argh, I dropped off this thread for a while. Sorry, lots of demands. I'd rather not replace suffixes with type ascription. For one thing, there are legitimate concerns raised on the type ascription thread about the desired syntax, and I don't know when it would be unfeature-gated precisely (though I think some form of type ascription is probably inevitable). In any case, it seems like needless backwards incompatibility and pain to remove suffixes. I've largely been persuaded that we should just use |
This comment has been minimized.
This comment has been minimized.
|
I don't have a strong preference here; |
This comment has been minimized.
This comment has been minimized.
archer884
commented
Feb 13, 2015
|
As little as it comes up, I'm kinda with everyone else with regard to it
|
This comment has been minimized.
This comment has been minimized.
|
Thanks for the new timeline and I'll update this RFC to use @archer884, I think #803 is a better place for discussions about type ascription. Let's talk there. :) |
CloudiDust
changed the title
Amend RFC 544: Use `isz/usz` as the literal suffixes for `isize/usize`
Amend RFC 544: Use `isize/usize` as the literal suffixes for themselves
Feb 14, 2015
This comment has been minimized.
This comment has been minimized.
|
\0/ |
This comment has been minimized.
This comment has been minimized.
|
Just FYI, I started a branch implementing these changes in the background just to observe the effect. So far, all uses of |
This comment has been minimized.
This comment has been minimized.
|
The branch is here if you are curious: https://github.com/nikomatsakis/rust/tree/suffixes |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis, thanks a lot. |
This comment has been minimized.
This comment has been minimized.
|
The core team has decided to accept this RFC. There have been lots of reasonable suggestions, but in the end going with the complete type name seems to be the most unambiguous -- inference ensures that writing out a |
nikomatsakis
referenced this pull request
Feb 18, 2015
Closed
Change suffixes to `isize` and `usize` #22496
nikomatsakis
merged commit 8c7895d
into
rust-lang:master
Feb 18, 2015
This comment has been minimized.
This comment has been minimized.
|
Tracking issue: rust-lang/rust#22496 |
CloudiDust commentedJan 12, 2015
This RFC (or RFC amendment) proposes that
isize/usizeget used as the literal suffixes for the typesisize/usize, in order to address the problems of the previously chosenis/us.This RFC used to promote
isz/usz, which was brought up by @rkjnsn in this thread.Rendered View.
Note: the Rendered View shows the amended RFC 544, but the interesting parts are better highlighted in the diff.