[swift-evolution] Implicit truncation
salutis at me.com
Mon May 22 06:17:07 CDT 2017
> 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...
More information about the swift-evolution