<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="">My quibble with this proposal (which should go through in one form or another) is that the initializers don’t throw.<div class=""><br class=""></div><div class="">I know that this was discussed before, but was this before "try?” was introduced to Swift? Because to me this seems cleaner (with <span class="pl-k" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; background-color: rgb(247, 247, 247); box-sizing: border-box; color: rgb(167, 29, 93);">init</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; background-color: rgb(247, 247, 247);" class="">(exact value: </span><span class="pl-c1" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; background-color: rgb(247, 247, 247); box-sizing: border-box; color: rgb(0, 134, 179);">Float</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; background-color: rgb(247, 247, 247);" class="">) </span><span class="pl-k" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; background-color: rgb(247, 247, 247); box-sizing: border-box; color: rgb(167, 29, 93);">throws</span>)</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> x = </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">try</span><span style="font-variant-ligatures: no-common-ligatures" class="">? </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">(exact: someFloat)</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Than this (with </span><span class="pl-k" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; background-color: rgb(247, 247, 247); box-sizing: border-box; color: rgb(167, 29, 93);">init</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; background-color: rgb(247, 247, 247);" class="">?(exact value: </span><span class="pl-c1" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; background-color: rgb(247, 247, 247); box-sizing: border-box; color: rgb(0, 134, 179);">Float</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; background-color: rgb(247, 247, 247);" class="">)</span>)</div><div class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> x = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(exact: someFloat)</span></div></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Let me be clear I’m not saying <i class="">no</i> initializers should ever be optional, just that with numeric conversions, it seems like the common case is that we got some bad data, and I like the “try?” syntax for noting, “Hey, this would mean something bad has happened.”</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">I also like ‘throws' because it could return something sensible so we could debug the bad input, whereas just returning ‘nil’ doesn’t really tell me why the conversion didn’t occur. In the example given (parsing through a json file) I’d much rather be able to tell the user “Warning, your file is corrupt: 4372498293429387283497824 is too big for your current net worth!” than “ Warning, your file is corrupt: 4372498293429387283497824 is somehow not good enough but I can’t really tell you why.”</div><div class=""><br class=""></div><div class="">-W</div></body></html>