[swift-evolution] floating point numbers implicit conversion

Brent Royal-Gordon brent at architechies.com
Sun Jun 18 00:02:45 CDT 2017

> On Jun 17, 2017, at 8:43 PM, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> How do you express the idea that, when you add values of disparate types T and U, the result should be of the type with greater precision? You need to be able to spell this somehow.

To be slightly less coy: You need to be able to say that one value type is a subtype of another. Then you can say Int8 is a subtype of Int16, and the compiler knows that it can convert any Int8 to an Int16 but not vice versa. This adds lots of complexity and makes parts of the compiler that are currently far too slow even slower, but it's not difficult to imagine, just difficult to practically implement given the current state of the Swift compiler.

Brent Royal-Gordon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170617/757775b2/attachment.html>

More information about the swift-evolution mailing list