<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Good point.<div class=""><br class=""></div><div class="">The real push here is that when the programmer *does* declare a type Equatable and the op == has an obvious implementation, that the programmer shouldn’t have to manually implement it him/herself. This would apply only to types that have been declared Equatable and that consist of exclusively properties which have all also been declared Equatable.</div><div class=""><br class=""></div><div class="">This would work much like the Haskell Eq class.</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Sep 12, 2016, at 12:03 PM, Robert Widmann <<a href="mailto:devteam.codafi@gmail.com" class="">devteam.codafi@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">Please be careful when wording this proposal. You want derived conformances, but don't obscure that message with the claim that every type admits a useful Equatable instance. It is most certainly <i class="">not</i> the case that every value type has a useful (read [mostly]: decidable) equality. A few counterexamples, the type of lazy streams (<a href="https://github.com/typelift/Swiftz/blob/swift-develop/Swiftz/Stream.swift#L24" class="">https://github.com/typelift/Swiftz/blob/swift-develop/Swiftz/Stream.swift#L24</a>) requires infinite space to evaluate a useful answer. The type of functions [without a modulus of continuity] also don't admit a useful, or even canonical, equality (in Swift at least). <br class=""><br class="">~Robert Widmann</div><div class=""><br class="">2016/09/10 8:24、Daniel Tartaglia via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> のメッセージ:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><span class="">Now that Swift 3 is out the door, I’m going to float this proposal again…</span><br class=""><span class=""></span><br class=""><span class="">Given that every value type should be equatable (rational here): <a href="https://www.andrewcbancroft.com/2015/07/01/every-swift-value-type-should-be-equatable/" class="">https://www.andrewcbancroft.com/2015/07/01/every-swift-value-type-should-be-equatable/</a></span><br class=""><span class="">And that many, if not most, value types consist of properties that are value types.</span><br class=""><span class="">Then the language should make it easy to conform to the Equatable protocol.</span><br class=""><span class=""></span><br class=""><span class="">In other words, if I declare my value type as Equatable, and it is exclusively composed of value types that are already equatable, then implementing the actual == function should be optional (or maybe even forbidden.)</span><br class=""><span class=""></span><br class=""><span class="">Implementing == in such cases is tedious boilerplate that the compiler should be able to infer on its own.</span><br class=""><span class=""></span><br class=""><span class="">Does anybody want to help me write up an official proposal?</span><br class=""></div></blockquote></div></div></blockquote></div><br class=""></div></body></html>