3 ms·
I agree the syntax is sensible. I quite like it in Swift: protocol Numeric { func +(lhs: Self, rhs: Self) -> Self } func<T: Numeric>(a: T,
by autoreleasepool 11y ago
I agree the syntax is sensible. I quite like it in Swift:
protocol Numeric {
func +(lhs: Self, rhs: Self) -> Self
}
func<T: Numeric>(a: T, b: T) -> T {
return a + b
}
- autoreleasepool 11y agoCorrection: Function name. func add<T: Numeric>(a: T, b: T) -> T { return a + b }