[swift-evolution] Universal Equatability, Hashability, and Comparability

William Dillon william at housedillon.com
Fri Mar 11 00:21:39 CST 2016


> On Mar 10, 2016, at 9:58 PM, Thorsten Seitz via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> Am 09.03.2016 um 22:34 schrieb Austin Zheng via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>>:
> 
>> I think we might (at least partially) be in violent agreement :). Most (if not everyone) on this thread has agreed that painless opt-in auto-conformance is a good thing ("struct Foo : Regular { .. }"), albeit with differing definitions of 'painless'. But I maintain that having a "func ==(lhs: Any, rhs: Any) -> Bool" stdlib fallback implementation of == is a lot of potential pain for very little benefit.
> 
> I agree completely. Not having everything comparable with everything is a good thing IMO!
> 

I can’t tell if I misunderstood Joe's original proposal, but I don’t think the suggestion was to have everything comparable to everything, but to have any type comparable with itself by default.  I’m against everything being comparable with everything else, but for having a default equality for every type with itself.

To re-state:

-1 to: func ==(lhs: Any, rhs: Any) -> Bool
+1 to: func ==<T> (lhs: T, rhs: T) -> Bool

- Will

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160310/d5992c30/attachment.html>


More information about the swift-evolution mailing list