<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="">On Apr 22, 2017, at 4:14 PM, Dave Abrahams <<a href="mailto:dabrahams@apple.com" class="">dabrahams@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class="">on Sat Apr 22 2017, David Sweeris <<a href="http://davesweeris-AT-mac.com" class="">davesweeris-AT-mac.com</a>> wrote:<br class=""><br class=""><blockquote type="cite" class="">Maybe we should make Float/Double conform to<br class="">"IEEE754Comparable"/"IEEE754Equatable" instead of<br class="">"Comparable"/"Equatable". Then it's all a moot point since floating<br class="">point types wouldn't end up in the same generic functions as other<br class="">comparable types.<br class=""><br class="">(Not sure if I'm serious)<br class=""></blockquote><br class="">Do you want to ban <br class=""><br class=""> Dictionary<Float,String><br class=""><br class="">? That would be one consequence.<br class=""></div></div></blockquote><br class=""></div><div>I started writing a big long reply last night, but I accidentally deleted the draft instead of saving it. Oh well, it was kinda rambly anyway. Here're my two (and a half?) main points:</div><div><br class=""></div><div>1.a) No</div><div>1.b) Although maybe we should, since this is the current behavior in playgrounds:</div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> dict = [</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures" class="">:</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">]()</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">dict</span><span style="font-variant-ligatures: no-common-ligatures" class="">[.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">nan</span><span style="font-variant-ligatures: no-common-ligatures" class="">] = </span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"Foo"</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">dict</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">description</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">// "[nan: "Foo”]” Yay!, it was inserted!</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">dict</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">[.</span><span style="font-variant-ligatures: no-common-ligatures" class="">nan</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">]?.</span><span style="font-variant-ligatures: no-common-ligatures" class="">description</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #008400" class="">// “nil" Wait, what?</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">dict</span><span style="font-variant-ligatures: no-common-ligatures;" class="">[.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">nan</span><span style="font-variant-ligatures: no-common-ligatures;" class="">] = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(209, 47, 27);" class="">"Bar"</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">dict</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">description</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">// "[nan: "Foo", nan: "Bar”]” Hey, how come two values have the same key?</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">dict</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">[.</span><span style="font-variant-ligatures: no-common-ligatures" class="">nan</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">]?.</span><span style="font-variant-ligatures: no-common-ligatures" class="">description</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #008400" class="">// “nil" And why can’t I retrieve either of them?</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> values: [</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">?] = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">dict</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">keys</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">map</span><span style="font-variant-ligatures: no-common-ligatures" class=""> { </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">dict</span><span style="font-variant-ligatures: no-common-ligatures" class="">[$0]?.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">description</span><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">values</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">description</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">// "[nil, nil]” I can’t even use the keys given by the dictionary itself to get my values?!?</span></div></div></div></blockquote>2) Maybe it would be helpful to think of Float and Double as sorta being their own Optional type with an extra payload to let a pseudo-“.none" explain <i class="">why</i> it's not a valid value. I’m not suggesting that we actually redefine Double as “Optional<Real64>” (even if we could get the extra payload), but if we <i class="">think</i> of them that way, it might simplify how we approach this.<div class=""><br class=""></div><div class="">- Dave Sweeris</div></body></html>