3 ms·
> The Swift Bool lives a double-life. The duplicitous struct has just one instance property — a 1-bit integer. > Think that’s okay? Think again. It isn’t even
by mrkeen 3y ago
> The Swift Bool lives a double-life. The duplicitous struct has just one instance property — a 1-bit integer.
> Think that’s okay? Think again. It isn’t even a real Int!
> It’s a Builtin type, Int1, which maps directly to an LLVM instruction deep in the guts of the Swift compiler.
Seems like the right way to build things.
I'd be surprised if you didn't find the same thing digging into its Int types - are they also not real Int types?
- jakey_bakey 3y agoYou’re exactly correct, they are also implemented internally as builtin int64 types (ie only useable by the compiler) - or maybe int32 depending on your hardware