[swift-evolution] [Completing Generics] Private and multiple conformances

Slava Pestov spestov at apple.com
Wed Mar 2 23:26:12 CST 2016

> On Mar 2, 2016, at 9:12 PM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
> Yeah, I suspect the overlap of dynamic casting and use cases for private conformances is small, so it seems unfortunate to me to hobble the language around the needs of dynamic casts. A workable rule might be to say that private or internal conformances aren't exposed to runtime lookup, so are never found by as? casts. We could then statically reject the `as? X<Y>` cast here since the X<Y> instantiation depends on a runtime-invisible conformance.

I feel like we talked about this in person a while back but I don’t remember the conclusion. What if dynamic cast lookup was lexically scoped to the conformances visible from the lookup location? I’m not quite sure how you would represent this at runtime but it seems feasible. 

> -Joe
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160302/bc8bbd3e/attachment.html>

More information about the swift-evolution mailing list