<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=""><br class=""><div><blockquote type="cite" class=""><div class="">Le 18 avr. 2017 à 06:45, Joe Groff via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Apr 17, 2017, at 9:40 PM, Chris Lattner &lt;<a href="mailto:clattner@nondot.org" class="">clattner@nondot.org</a>&gt; wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Apr 17, 2017, at 9:07 AM, Joe Groff via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Apr 15, 2017, at 9:49 PM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class="">For example, I expect `XCTAssertEqual&lt;T : FloatingPoint&gt;(_:_:)` to be vended as part of XCTest, in order to make sure that `XCTAssertEqual(resultOfComputation, Double.nan)` always fails.<br class=""></blockquote><br class="">Unit tests strike me as an example of where you really *don't* want level 1 comparison semantics. If I'm testing the output of an FP operation, I want to be able to test that it produces nan when I expect it to, or that it produces the right zero.<br class=""></blockquote><br class="">I find it very concerning that == will have different results based on concrete vs generic type parameters. &nbsp;This can only lead to significant confusion down the road. &nbsp;I’m highly concerned about situations where taking a concrete algorithm and generalizing it (with generics) will change its behavior.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">In this case, I think we're making == do exactly what you want it to do based on context. If you're working concretely with floats, then you get floating-point behavior like you'd expect. If you're working with generically Equatable/Comparable things, then you're expecting the abstract guarantees of interchangeability and total ordering that implies, and you don't want to have to think about the edge cases of weird types that violate those constraints. I also doubt that this will cause problems in practice.</span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>"then you're expecting the abstract guarantees of interchangeability and total ordering that implies"</div><div><br class=""></div><div>Joe, please: I'm very glad that you are expert in so many subject - I'd love to have your job - but please keep track of average joes that have to scratch their heads whenever they have to deal with nans and infinites and subnormals and all those weird floating beasts. They already scratch their heads with the idiosyncrasies of Swift protocols.</div><div><br class=""></div><div>Please keep equality simple.</div><div><br class=""></div><div>Gwendal Roué</div><div><br class=""></div></div></body></html>