Right; what I should have said is there's no way to mark it on the per-function level rather than dispatching within the function. To put it another way, if a non-stdlib module defined its own integer type MyInt: FixedWidthInteger
and a MyInt.init(_ source: Float)
method, there's no way for it to mark that MyInt.init(_ source: Float)
is allowed to be called rather than the generic FixedWidthInteger.init<T: BinaryFloatingPoint>(_ source: T)
within the stdlib; every floatToUnorm
-like method would need to manually add it as a known type.
(Yes, there are workarounds if FixedWidthInteger.init<T: BinaryFloatingPoint>(_ source: T)
is a protocol requirement, where MyInt.init(_ source: T)
could manually dispatch; my point is more that I don't think writing out lists of manual specialisations should be necessary).