3 ms·
If interfaces could have type parameters, then you could just do something like: func convert(Type2, Type1 ConvertibleTo(Type2))(a Type1, b Type1){…} However,
by comex 7y ago
If interfaces could have type parameters, then you could just do something like:
func convert(Type2, Type1 ConvertibleTo(Type2))(a Type1, b Type1){…}
However, that wouldn’t work as well if you wanted multiple methods with different receiver types, e.g. if you wanted to require convertibility in both directions.