> On May 16, 2016, at 5:49 PM, Dan Appel <[email protected]> wrote:
> 
> Just to clarify: in your example, did you mean for DerivedA and DerivedB to 
> inherit from Base?

Yeah, sorry about that.

-Joe

> 
> On Mon, May 16, 2016 at 4:18 PM Matthew Johnson via swift-evolution 
> <[email protected]> wrote:
> +1
> 
> Sent from my iPhone
> 
> > On May 16, 2016, at 4:06 PM, Joe Groff via swift-evolution 
> > <[email protected]> wrote:
> >
> > 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:
> >
> >    20 as Int64 < y as Int64 // error, '>' expected to close generic 
> > parameter list Int64<y>
> >
> > 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:
> >
> >    class Base {}
> >    class DerivedA {}
> >    class DerivedB {}
> >
> >    var x: Base.Type = DerivedA
> >
> >    DerivedA() as? x // succeeds
> >    DerivedB() as? x // fails
> >
> > 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 < 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?
> >
> > -Joe
> > _______________________________________________
> > swift-evolution mailing list
> > [email protected]
> > https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution
> -- 
> Dan Appel

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to