-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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: turn true
and false
into enums
#5266
Comments
I agree with the point that having |
|
Those are different though because they aren't defined in the core library. They are just magic always-in-scope identifiers. |
@brson: I think using |
What would you really gain by removing it? It seems like boolean values are such a fundamental thing, conceptually part of if statements etc., that it IS in the language, even if not present by named tokens. It makes sense to keep complex, optional things, like bitstrings in the core/standard libraries, but come on... when are you going to write a program that WON'T have boolean values/logic in it? And if you have that, where is the sense in moving one line of that to a separate file? If the point is to simply have fewer keywords, I don't think these are the keywords to drop. bools are EVERYWHERE in programming. I was very glad to see them given their proper (standardised) place, as keywords, in C++, as opposed to the (sometimes conflicting) macros like TRUE and FALSE and True and so on in C. |
@lee-b: two reasons that I can think of. First off, there shouldn't be any impact to the end user. We'll still have Second: this will simplify the compiler and should help us to avoid bugs. With booleans as a first class object, it's easy for us to fix a bug for booleans and not for other types, or vice versa. For everyone else: There's one more case to consider, which is that of the serializers. I like the idea of keeping |
@thestinger: If we do that, then should we bite the bullet and capitalize all our built in types? |
@erickt: Well, in my opinion that would be the best thing to do. Using a different naming convention for the built-in types just seems inconsistent. I don't know if it's really worth the work to switch it all though :). |
@thestinger but turning |
If you're not going to change the rest of the types to upper-case, please don't change bool/true/false. The very thought is making me cringe. |
@bstrie: I think it would be |
I don't think the asymmetry between literals and type names is unusual. It's the same for integers, chars, etc. I'm not really into making any changes in this area. Primitive types have built in meaning at several layers. |
discussed at weekly meeting, decided against (no strong advocate and I'm pretty opposed on grounds of symmetry with other primitive types) |
Lint `if let Some` and early return in question_mark lint Fixes rust-lang#5260 changelog: lint `if let Some` and early return in `question_mark` lint
The text was updated successfully, but these errors were encountered: