<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 18 Aug 2016, at 19:46, John McCall <<a href="mailto:rjmccall@apple.com" class="">rjmccall@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">On Aug 18, 2016, at 10:15 AM, Davor Jankolija via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class=""><blockquote type="cite" class="">This is a warning right now — do you think it should be an error?<br class=""><br class="">Slavas-MacBook-Pro:~ slava$ cat ttt.swift<span class="Apple-converted-space"> </span><br class="">func f() {}<br class=""><br class="">func g() {<br class="">try f()<br class="">try? f()<br class="">}<br class=""><br class="">Slavas-MacBook-Pro:~ slava$ swiftc ttt.swift<span class="Apple-converted-space"> </span><br class="">ttt.swift:4:3: warning: no calls to throwing functions occur within 'try' expression<br class="">try f()<br class="">^<br class="">ttt.swift:5:8: warning: no calls to throwing functions occur within 'try' expression<br class="">try? f()<br class=""> ^<br class=""></blockquote><br class="">IMHO at least, this should be an error. As a side note I do think that try should have greater precedence than as, even though this does potentially limit calls that would use only one try on a series of throwing statement that can be handled using parentheses. The benefit is that try is probably called in the vast majority of situations (that’s my experience at least) on a single throw statement and having it have higher precedance would avoid some surprises as most developers probably already assume that try wil be executed before as.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">The design of ordinary 'try' and 'try!' are that they includes the entire expression to the right, spanning casts and other binary operators, and I think that's clearly the right rule for them. It's not as clearly right for 'try?', but making 'try' and 'try?' be parsed differently would be horribly confusing.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">John.</span></div></div></blockquote></div><br class=""><div class="">I see what you’re saying and I have to agree for the most part, it’s just that now you basically get a ‘try’ executed on the result of the ‘as?’ expression, which although is correct now that I look at your explanation is somewhat unintuitive, again this is just my opinion.</div><div class=""><br class=""></div><div class="">P.S.</div><div class="">It would seem then, that the best way and probably simplest is to remember and place parentheses around the ‘try call()’ and then attempt a cast?</div><div class=""><br class=""></div><div class="">— Davor</div></body></html>