<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 Jun 29, 2017, at 7:35 PM, Yuta Koshizawa &lt;<a href="mailto:koher@koherent.org" class="">koher@koherent.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class=""><span style="font-size:14px" class="">"In -Ounchecked builds, the optimizer may assume that this function is never called. Failure to satisfy that assumption is a serious programming error.”</span></div></blockquote><div class=""><br class=""></div><div class="">Yes, and so the following `!!` can perform identically to `!` in -Ounchecked builds when it is inlined.</div></div></div></blockquote><div><br class=""></div><div>Yes, I guess I wasn’t clear. I mean that there’s no problem.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><font class=""><span style="white-space:pre-wrap" class="">public static func !!(optional: Optional, errorMessage:
@autoclosure () -&gt; String) -&gt; Wrapped {
    precondition(optional != nil, errorMessage())
    return optional!
}</span></font></div><div class=""><font class=""><span style="white-space:pre-wrap" class=""><br class=""></span></font></div><div class="gmail_extra"><div class=""><div class="gmail_signature">--<br class="">Yuta</div></div><div class="gmail_signature"><br class=""></div>
<br class=""><div class="gmail_quote">2017-06-29 6:42 GMT+09:00 Jaden Geller <span dir="ltr" class="">&lt;<a href="mailto:jaden.geller@gmail.com" target="_blank" class="">jaden.geller@gmail.com</a>&gt;</span>:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-"><br class="">
&gt; On Jun 28, 2017, at 7:47 AM, Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class="">
&gt;<br class="">
&gt;<br class="">
&gt;&gt; On Jun 28, 2017, at 3:52 AM, Yuta Koshizawa via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class="">
&gt;&gt;<br class="">
&gt;&gt; Hi, I think it is an orthogonal issue if we need a new operator. It is<br class="">
&gt;&gt; also possible to introduce an infix `!` for it.<br class="">
&gt;&gt;<br class="">
&gt;&gt; I am sure that we do not need to avoid `precondition` as long as we<br class="">
&gt;&gt; use it appropriately. It is useful to realize consistent behavior with<br class="">
&gt;&gt; `Array`'s `subscript`, forced unwrapping `!`, `&amp;+` and so on. In this<br class="">
&gt;&gt; context, `precondition` does not mean a general word "precondition"<br class="">
&gt;&gt; but the `precondition` function in the Swift standard library, which<br class="">
&gt;&gt; is removed when -Ounchecked.<br class="">
&gt;<br class="">
&gt;<br class="">
&gt; How would the line run then? Would it simply act as a forced unwrapped under -Ounchecked?<br class="">
<br class="">
</span>From the docs:<br class="">
<br class="">
"In -Ounchecked builds, the optimizer may assume that this function is never called. Failure to satisfy that assumption is a serious programming error.”<br class="">
<br class="">
Aka, v. bad things happen if the precondition does not hold.<br class="">
<div class="gmail-HOEnZb"><div class="gmail-h5"><br class="">
&gt;<br class="">
&gt; -- E<br class="">
&gt;<br class="">
&gt; ______________________________<wbr class="">_________________<br class="">
&gt; swift-evolution mailing list<br class="">
&gt; <a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="">
<br class="">
</div></div></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>