[swift-evolution] Implicit truncation
Guillaume Lessard
glessard at tffenterprises.com
Tue May 23 13:16:04 CDT 2017
I completely agree with Haravikk. This is not C, we have type inference, and this behaviour is different from other non-failable lossy conversions in Swift.
Regarding uses of ‘truncating’, Xiaodi is wrong. The documentation of BinaryInteger.init<T: FloatingPoint>(_ source: T) in the accepted proposal specifically uses the term in the way the original poster used it:
/// Creates an integer from the given floating-point value, truncating any
/// fractional part.
(https://github.com/apple/swift-evolution/blame/master/proposals/0104-improved-integers.md#L444)
Cheers,
Guillaume Lessard
More information about the swift-evolution
mailing list