
Description
EDIT: See @RaphiJS6-13 below for a better idea.
Minor part of #5895 that was not moved out following the post-#7396 purge. Remedying that now.
When a function takes an argument or a struct has a field of type comptime_int
or comptime_float
, the declaration is already annotated with comptime
. A second comptime
in the type name just seems repetitive. Removing it would have psychological benefits as well: the types seem less like arcane compiler details and more like a normal, everyday part of code, which they are, and makes it more obvious why every literal requires a type (status quo: "What's the type of this? It's an int. All looks normal. compile error Excuse me? flips through docs Oh, yeah, it's a comptime_int
. Right."; this proposal: "What's the type of this? It's an int
. Oh, yeah, that's a comptime-only type, isn't it? Better coerce it.").
There is precedent for this: type
, anytype
and such are comptime-only (or have restrictions on their use), and do not have any special markings indicating this. Continuing this pattern with int
and float
I believe will be a valuable step toward normalising comptime in the minds of users. I think of it like this: comptime_int
and comptime_float
sound like specialsed, arcane types, but they're actually in a way the most basic numeric types in the language, the types which coerce to all others. They should have suitably "basic" names.