[swift-evolution] protocol-oriented integers (take 2)

Ben Rimmington me at benrimmington.com
Tue Jan 17 11:43:01 CST 2017


	public protocol Arithmetic {
	  init?<T : BinaryInteger>(exactly source: T)

	public protocol BinaryInteger : Arithmetic {
	  init?<T : FloatingPoint>(exactly source: T)

Should the `init?(exactly:)` initializers belong to the same protocol?
Would this allow generic conversions between integer and floating-point types?
For example, a failable `numericCast` function.

-- Ben

More information about the swift-evolution mailing list