floating point numbers implicit conversion

Oh, ok... I thought you meant "conditional conformance" or something concrete :-D

Off the top of my head, with "literals as generic parameters",
protocol Addable {
  associatedtype BitsOfPrecision: IntegerLiteral
  static func + <T: Addable> (_: Self, _: T) -> T where T.BitsOfPrecision >
BitsOfPrecision
  static func + <T: Addable> (_: Self, _: T) -> Self where T.BitsOfPrecision <= BitsOfPrecision
}

Although, come to think of it, I suppose that's a bit more than simply using literals as types. Still, it's all information that's available at compile time, though.

- Dave Sweeris

···

On Jun 17, 2017, at 20:43, Xiaodi Wu <xiaodi.wu@gmail.com> wrote:

In Swift, all types and all operators are implemented in the standard library. How do you express the idea that, when you add values of disparate types T and U, the result should be of the type with greater precision? You need to be able to spell this somehow.