Why are fundamental types not UpperCamelCase?

We were having a discussion about why Rust's fundamental types might not adhere to the UpperCamelCase type naming convention, but couldn't come up with the particular reasons that would have motivated the original creators.

Is it merely a remnant from old conventions forced upon us by backwards compatibility, or is there an actual (preorchestrated) design decision?

What specifically do you mean by "fundamental types"?

i8, i16, u32, f64, etc.

Cool. There is an attribute called fundamental, so I wanted to make 100% sure, I thought this is what you meant. We call those "primitive types." Anyway!

I don't remember offhand why, but it was an explicit decision that primitive types would be all in lower case, and non-primitive ones would follow a different set of conventions. Maybe I will find a source later, but I can't at the moment.


Gotcha. Thank you for clarifying! If you do manage to find the source, that'd be great! It'd be interesting to to see what the original (and continued) vision on that topic is.

I feel like over time lines have begun to fade between "primitive types" and types that are commonly associated with Rust - because they are included in the std's prelude - so I feel like this is one of those implicit intricacies of the language. An additional layer of mystery was added to the problem because the naming conventions don't include primitive types.

Maybe there is a misconception. Primitive types are the building blocks of compound types, i.e. struct and enum. If you like they are the atoms of Rust's types. You can't (really) create your own primitive types. Probably, this is the reason why they are not mentioned in the style guide.

1 Like

Yes, I understand that that is the case. Our original discussion flowed from the fact that "it was believed inconsistent to have different naming conventions for types".

However, consistency is obviously dependant on your goal. E.g. if you want to create a split between primitive types and compound types (or aliases), then it is consistent to have a different naming scheme for the two categories. At that point it becomes a very philosophical discussion though, so I tried to shy away from that in my original post; instead asking for what the motivation was to create the divide.

1 Like


There’s not much actual discussion, but here’s one early place where this change was proposed and rejected:


Personally, I prefer that the primitive types, including marker types, are lower-case. That distinction lowered my learning curve because it informed me that I did not need to delve deeper into their definition. (Of course that didn't stop me from looking at rustc source to see how they and the primitive operators on them actually were defined. :grin:)


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.