There are no non-failable value-preserving conversions from floating point values of any type to integers of any type. The API naming guidelines do not require that _only_ value-preserving type conversions omit the first argument; in this case, a strong convention among C family languages exists for the behavior of the conversion, and the guidelines tell us to omit needless words. This spelling has already been reviewed and approved for Swift 4. What are the "subtle bugs all over the place" that you observe, and what did those users expect to happen? On Mon, May 22, 2017 at 06:17 Rudolf Adamkovič via swift-evolution < [email protected]> wrote:
> Reply below. > > On 22 May 2017, at 06:44, Xiaodi Wu via swift-evolution < > [email protected]> 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? > > R+ > > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
