# An Implementation Model for Rational Protocol Conformance Behavior

**URL:** <https://forums.swift.org/t/an-implementation-model-for-rational-protocol-conformance-behavior/37171>\
**Category:** Pitches\
**Tags:** generics\
**Created:** [June 3, 2020, 12:38am UTC](https://forums.swift.org/t/an-implementation-model-for-rational-protocol-conformance-behavior/37171 "2020-06-03T00:38:15Z")\
**Posts on this page:** 1\
**Showing post:** 137

<div class="post-metadata">

**Author:** ![dabrahams](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dabrahams/32/9815_2.png) [@dabrahams](https://forums.swift.org/u/dabrahams)\
**Post date:** [June 21, 2020, 9:03pm UTC](https://forums.swift.org/t/an-implementation-model-for-rational-protocol-conformance-behavior/37171/137 "2020-06-21T21:03:04Z")

</div>

> [@mattrips](#):
>
> In the resultant binary, the Protocol Witness Table Pattern for `X: Q` does _not_ point to `Q.id` as the witness for the `id` requirement. AFAICS, the table pattern for `X: Q` solely points to the protocol witness table for `X: P` .  
> …  
> Yes, the `X: Q` conformance is conditional, but since the table is used only in contexts in which the condition is satisfied, the table should (?) point to `Q` 's implementations.
> 
> Am I misunderstanding?

Hi Matt,

AFAICT this code is almost the same as [my earlier example](https://forums.swift.org/t/an-implementation-model-for-rational-protocol-conformance-behavior/37171/102). My `id2` (which corresponds to `callID` in your example) would be on an extension of `Q` rather than of `P`. So your example effectively points out that the `P` requirement `id` is satisfied the same way for the `X<T>:P` witness table as for the `X<T>:Q` witness table. I find that mostly unsurprising given the (always re-surprising!) fact that `X<T>` can only conform to `P` “in one way.” It's also nearly the same as [your earlier example](https://forums.swift.org/t/an-implementation-model-for-rational-protocol-conformance-behavior/37171/100) except in that example your `P` requirement `a()` (which corresponds to `id`) is being accessed through a different `P` requirement `b()`, rather than a non-requirement (`callId`/`id2`).

Also, all of these semantics seem consistent with what @Jens [pointed out](https://forums.swift.org/t/ergonomics-generic-types-conforming-in-more-than-one-way/34589/44) about the original proposals: we were warned. It's only since I realized this had serious negative consequences for generic programming that I've started hearing @Douglas_Gregor suggest that it could be changed. However, there are two very open questions still, AFAICT:

- Is Doug actually talking about the same things we are? So far his description has been in very implementation-centric terms that don't map clearly onto a programming model.
- Can we change the language semantics and call it a bug fix, even if the language implements exactly or nearly what was proposed and accepted?

Surely WWDC pressure explains why we don't have answers yet; I look forward to Doug's re-engagement after the conference is over.

---

_[View the full topic](https://forums.swift.org/t/an-implementation-model-for-rational-protocol-conformance-behavior/37171)._
