<html><head></head><body>+1 Missed this one for a long time :)<div><div> <br><div class="bloop_sign"><div>--&nbsp;<br>Adrian Zubarev</div></div> <p class="gmail_quote" style="color:#000;">Am 17. Mai 2016 um 16:25:10, David Hart via swift-evolution (<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>) schrieb:</p> <blockquote type="cite" class="gmail_quote"><span><div><div></div><div>+1 Seems like it could enable very powerful behaviour going forward<br><br><blockquote type="cite">On 16 May 2016, at 23:06, Joe Groff via swift-evolution &lt;swift-evolution@swift.org&gt; wrote:<br><br>Currently, we parse a type after 'as[?!]' and 'is'. This is mostly what you'd expect, but does lead to problems when an 'as' expression appears as part of a comparison:<br><br>        20 as Int64 &lt; y as Int64 // error, '&gt;' expected to close generic parameter list Int64&lt;y&gt;<br><br>Looking to the future, many people have also expressed interest in the ability to do dynamic type checks against metatype values, not only static types, as in:<br><br>        class Base {}<br>        class DerivedA {}<br>        class DerivedB {}<br><br>        var x: Base.Type = DerivedA<br><br>        DerivedA() as? x // succeeds<br>        DerivedB() as? x // fails<br>        <br>If we accept https://github.com/apple/swift-evolution/blob/master/proposals/0090-remove-dot-self.md, dropping the '.self' requirement to refer to type objects, then I think we should also change 'is' and 'as' to parse the expression grammar on their right-hand side, leaving it up to the normal expression disambiguation rule to handle angle brackets. This solves the '20 as Int64 &lt; x' problem, and prepares us to support dynamic is/as queries in the future. (To be clear, designing dynamic queries should be its own discussion.) What do you all think?<br><br>-Joe<br>_______________________________________________<br>swift-evolution mailing list<br>swift-evolution@swift.org<br>https://lists.swift.org/mailman/listinfo/swift-evolution<br></blockquote><br>_______________________________________________<br>swift-evolution mailing list<br>swift-evolution@swift.org<br>https://lists.swift.org/mailman/listinfo/swift-evolution<br></div></div></span></blockquote>
    </div></div></body></html>