[swift-evolution] [Pitch] Ban the top value in Int/UInt / use smaller Integer
Martin Waitz
tali at admingilde.org
Thu Oct 20 09:51:22 CDT 2016
Hello,
> It's just that a common data type wasting almost half the space seems
> inefficient. I guess this is also the reason why they didn't adopt
> optional integers widely in stdlib.
When someone is really interested in fitting an optional integer into
one machine word,
then the best way would be to use a smaller integer type (e.g. Int32
instead of Int64).
These also can be mapped well into Enums (a single reserved value does
not help at all here).
There are some almost 64-bit integers (Builtin.Int60 .. Builtin.Int63).
Maybe something like this could also be provided for normal use?
--
Martin
More information about the swift-evolution
mailing list