[swift-evolution] floating point numbers implicit conversion

David Sweeris davesweeris at mac.com
Sat Jun 17 22:39:28 CDT 2017


> On Jun 17, 2017, at 16:16, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> On Sat, Jun 17, 2017 at 3:21 PM, Ted F.A. van Gaalen <tedvgiosdev at gmail.com> wrote:
>> 
>> As you know, Swift currently does not facilitate implicit conversion (coercion),
>> which implies that current code (which of course does not contain implicit conversions) 
>> will function exactly as it does now,
> 
> That is not implied. Swift has type inference, which means that, with the implementation of implicit promotion, the inferred type of certain expressions that are legal today will change. For instance, integer literals have no type of their own and are inferred to be of some type or another based on context. When combined with bitwise operators, the presence or absence of overloads that allow heterogeneous operations can change the result of code that compiles both before and after the implementation of the feature. This is just one example of why implicit integer promotion in a strictly typed language with type inference and without certain generics features is very hard.

I'm not sure which generic features you're referring to. Would you (or anyone else who knows) mind elaborating?

- Dave Sweeris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170617/565bbaa7/attachment.html>


More information about the swift-evolution mailing list