[swift-dev] Reconsidering the global uniqueness of type metadata and protocol conformance instances

John McCall rjmccall at apple.com
Sat Jul 29 15:39:12 CDT 2017


> On Jul 29, 2017, at 4:33 PM, Chris Lattner <clattner at nondot.org> wrote:
>> On Jul 29, 2017, at 1:32 PM, John McCall <rjmccall at apple.com> wrote:
>> 
>>> On Jul 29, 2017, at 4:24 PM, Chris Lattner via swift-dev <swift-dev at swift.org> wrote:
>>> 
>>> On Jul 28, 2017, at 2:20 PM, Joe Groff via swift-dev <swift-dev at swift.org> wrote:
>>>> 
>>>> Overall, my intuition is that the tradeoffs come out in favor for nonunique metadata objects, but what do you all think? Is there anything I'm missing?
>>> 
>>> I think your proposal makes sense, particularly when we start caring about metadata/conformances for non-nominal types, which don’t have a declaration location.  They are a bit over the horizon right now, but we need to support making tuples conform to protocols someday.  Eliminating the requirement for them to be uniquely emitted across the entire program would make that much simpler, because otherwise you’re in the land of weak symbols or something.
>> 
>> Not really, because the conformance is presumably still declared somewhere in Swift and therefore has a natural unique definition point even if the type doesn’t.
> 
> Ok, so you’re suggesting that the stdlib would have the “automatically provided” conditional conformances for things like equatable, then each module that actually uses one gets a specialization?

Well, presumably the stdlib's generic conformance would actually be usable itself, but yes, other modules could of course emit specialized witness tables if they want.

John.


More information about the swift-dev mailing list