Some vs Any

What problem do some and any solve? var x: Equatable = 10 // Error: Use of protocol 'Equatable' as a type must be written 'any Equatable' var y: Equatable = "10" // Same error Youโ€™s think the compiler should let the above compile, it rightfully doesnโ€™t. The compiler canโ€™t know if the associated type of x, matches with the associated type of y. So it just forbids it. Compiler just doesnโ€™t want to be in situation where youโ€™d try something like:...

July 17, 2024 ยท 4 min