<div dir="ltr">I&#39;ve found a similar thing useful, but with Errors instead of fatalErroring:<div><br></div><div><div>infix operator ?! : NilCoalescingPrecedence</div><div><br></div><div>func ?!&lt;T&gt;(lhs: T?, rhs: @autoclosure () -&gt; Error) throws -&gt; T {</div><div>    if let lhs = lhs { return lhs }</div><div>    throw rhs()</div><div>}</div><div><br></div><div>let x = try failableFunc() ?! MyError.somethingFailed<br></div><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><div><br></div></div></div></div>
<br><div class="gmail_quote">On Tue, Jun 27, 2017 at 10:29 AM, Adrian Zubarev via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div class="gmail-m_7526005730894717182bloop_markdown"><p>+1 I had a slightly different implementation.</p>

<p><a href="https://gist.github.com/DevAndArtist/dad641ee833e60b02fd1db2dbb488c6a" target="_blank">https://gist.github.com/<wbr>DevAndArtist/<wbr>dad641ee833e60b02fd1db2dbb488c<wbr>6a</a></p>

<pre><code>//
// UnwrapOrTrap.swift
//
infix operator ?! : NilCoalescingPrecedence

/// Performs a nil-coalescing operation, returning the wrapped value of an
/// `Optional` instance or uses the rhs function to stop the program.
///
/// - Parameters:
///   - optional: An optional value.
///   - noreturn: A function to stop the programm.
func ?!&lt;T&gt;(optional: T?, noreturn: @autoclosure () -&gt; Never) -&gt; T {
   switch optional {
   case .some(let value):
      return value
   case .none:
      noreturn()
   }
}
</code></pre><span class="gmail-HOEnZb"><font color="#888888">

<p></p></font></span></div><div class="gmail-m_7526005730894717182bloop_original_html"><span class="gmail-HOEnZb"><font color="#888888"><div id="gmail-m_7526005730894717182bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgb(0,0,0);margin:0px"><br></div> <br> <div id="gmail-m_7526005730894717182bloop_sign_1498584478928029184" class="gmail-m_7526005730894717182bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div></font></span><div><div class="gmail-h5"> <br><p class="gmail-m_7526005730894717182airmail_on">Am 27. Juni 2017 um 19:25:15, Erica Sadun via swift-evolution (<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>) schrieb:</p> </div></div><blockquote type="cite" class="gmail-m_7526005730894717182clean_bq"><span><div style="word-wrap:break-word"><div></div><div><div><div class="gmail-h5">






<div>Using an operator to provide feedback on the context
of a failed unwrap has become a commonly implemented approach in
the Swift developer Community. What are your thoughts about
adopting this widely-used operator into the standard library?</div>
<div><br></div>
<div><font face="Menlo">guard !lastItem.isEmpty
else { return }</font></div>
<div><font face="Menlo">let lastItem = array.last
!! &quot;Array must be non-empty&quot;</font></div>
<div><br></div>
<div>Details here:  <a href="https://gist.github.com/erica/423e4b1c63b95c4c90338cdff4939a9b" target="_blank">https://gist.github.com/<wbr>erica/<wbr>423e4b1c63b95c4c90338cdff4939a<wbr>9b</a></div>
<div><br></div>
<div>Thank you for your thoughtful feedback, -- E</div>
<div><br></div></div></div><span class="gmail-">


______________________________<wbr>_________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br></span></div></div></span></blockquote></div><div class="gmail-m_7526005730894717182bloop_markdown"><p></p></div></div><br>______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div></div></div>