<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="">Also a +1 from me. This is something I always put in to my code.<div class=""><br class=""></div><div class="">I agree that having `Never` as a bottom type is interesting, but even if that were the case, the proposed “!!” operator is still useful, because it short-circuits having to fatalError() myself. IE:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">let last = array.last ?? fatalError(“array must not be empty”)</span></font></div><div class=""><br class=""></div><div class="">vs</div><div class=""><br class=""></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">let last = array.last !! “Array must not be empty"</span></font></div><div class=""><br class=""></div><div class="">I also think having it “fatalError” in shipping code is fine, because it’s equivalent to what would happen if you incorrect force-unwrap.</div><div class=""><br class=""></div><div class="">Dave<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 27, 2017, at 12:08 PM, Zach Waldowski via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<title class=""></title>
<div class=""><div style="font-family:Arial;" class="">Big +1.<br class=""></div>
<div class=""><div style="font-family:Arial;" class=""><br class=""></div>
</div>
<div class="">Using `!` is widely seen as a smell. However, the need for it still arises; they are preconditions, of a sort. It has become prevalent in my teams’ codebases to do “guard else preconditionFailure”.<br class=""></div>
<div style="font-family:Arial;" class=""><div style="font-family:Arial;" class=""><br class=""></div>
</div>
<div style="font-family:Arial;" class="">I like `!!` over something like `?!`; it follows the pattern that almost every `?` in the language has an equivalent `!`.<br class=""></div>
<div class=""><div style="font-family:Arial;" class=""><br class=""></div>
</div>
<div class=""><div style="font-family:Arial;" class="">The implementation details are ultimately not relevant to me. I’m a fan of `Never` being a bottom type for more reasons than just this. I also see no reason why operator funcs couldn’t accept file and line as extra arguments on the rhs.<br class=""></div>
</div>
<div style="font-family:Arial;" class=""><br class=""></div>
<div id="sig20055365" class=""><div class="signature"><span class="font" style="font-family:arial, sans-serif, sans-serif">Best,</span><span class="font" style="font-family:arial, sans-serif, sans-serif"></span><br class=""></div>
<div class="signature"><span class="font" style="font-family:arial, sans-serif, sans-serif"> Zachary Waldowski</span><span class="font" style="font-family:arial, sans-serif, sans-serif"></span><br class=""></div>
<div class="signature"><span class="font" style="font-family:arial, sans-serif, sans-serif"> </span><a href="mailto:zach@waldowski.me" class=""><span class="font" style="font-family:arial, sans-serif, sans-serif">zach@waldowski.me</span></a><span class="font" style="font-family:arial, sans-serif, sans-serif"></span><br class=""></div>
<div style="font-family:Arial;" class=""><br class=""></div>
<div style="font-family:Arial;" class="">On Tue, Jun 27, 2017, at 01:16 PM, Erica Sadun via swift-evolution wrote:<br class=""></div>
</div>
<blockquote type="cite" class=""><div class="">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?<br class=""></div>
<div class=""><br class=""></div>
<div class=""><span class="font" style="font-family:Menlo">guard !lastItem.isEmpty else { return }</span><br class=""></div>
<div class=""><span class="font" style="font-family:Menlo">let lastItem = array.last !! "Array must be non-empty"</span><br class=""></div>
<div class=""><br class=""></div>
<div class="">Details here: <a href="https://gist.github.com/erica/423e4b1c63b95c4c90338cdff4939a9b" class="">https://gist.github.com/erica/423e4b1c63b95c4c90338cdff4939a9b</a><br class=""></div>
<div class=""><br class=""></div>
<div class="">Thank you for your thoughtful feedback, -- E<br class=""></div>
<div class=""><br class=""></div>
<div class=""><u class="">_______________________________________________</u><br class=""></div>
<div class="">swift-evolution mailing list<br class=""></div>
<div class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""></div>
<div class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div>
</blockquote><div style="font-family:Arial;" class=""><br class=""></div>
</div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></div></body></html>