[swift-evolution] Implicit truncation

Rudolf Adamkovič salutis at me.com
Mon May 22 06:17:07 CDT 2017

Reply below.

> On 22 May 2017, at 06:44, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> […], but the unlabeled spelling is not harmful, as `Int.init(_: Float)` is after all a non-failable initializer that converts from a floating point value to an integer value. 

I respectfully disagree. From my experience (tutoring), this is harmful. It leads to subtle bugs all over the place. That’s what I observe.

Another citation from Swift API Guidelines:

> In initializers that perform value preserving type conversions, omit the first argument label, e.g. Int64(someUInt32)

This is not a value preserving conversion, is it?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170522/3af246f7/attachment.html>

More information about the swift-evolution mailing list