<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></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 1 Nov 2016, at 01:37, Joe Groff 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=""><div class="">Sorry for piling onto the bikeshed. We do already have a notation for testing that an Optional isn't nil, `x != nil`. We could theoretically bless `<decl ref> != nil` as a statement condition to also unwrap the referenced declaration in the scope guarded by the condition. (`<decl ref> is T` could similarly rebind a declaration as the cast type.)<br class=""><br class="">-Joe<br class=""></div></div></blockquote></div><br class=""><div class="">Was about the say the same thing; this is basically the same idea as type narrowing, which is something I think that Swift still really needs, and can be used to solve this problem without the need for new syntax, enabling things like:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>if (a is Foo) { a.someMethodSpecificToFoo() }</font></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>if (a != nil) { a.someMethodWithoutUnwrapping() }</font></div><div class=""><br class=""></div><div class="">While I've often suggested keywords to solve other problems, I'm not sure if we really need one to solve this use-case!</div></body></html>