Quoting out of order to condense related things:
Yeah, now I see it! I still maintain you can remove removing the Q: Equatable
refinement and associated extension on R
without changing anything substantive about your example, though.
So, under the existing model (as I understand it),
id2
is handled statically at compile time, whileb()
is handled dynamically at run time.
I…guess you could put it that way(?) but it's a bit misleading. The whole point of id2
is to get out of the way of any overloads that might be more specific than P
's id
requirement and thereby coax its use of id
to be dynamically dispatched through the P
witness table. Most people do this in examples by writing a generic function:
func id2<T: P>(x: T) -> String { x.id }
I interpret your example and question to @Douglas_Gregor to be focussed on changing the model. My example and question are focussed on understanding whether certain observed behavior is a bug or consistent with the intended behavior.
Well, those things are all bound up together, ain't they? If Doug confirms my understanding, my next question will be whether he's confident that the community and core team will accept the semantic change as a bug fix.
Finally, as I understand the intended behavior of the existing model, in your example, the output is expected and correct while, in my example, the intended output might be unexpected and incorrect.
This is why we need that documentation thread, really. These notions are all completely fuzzy at the moment, partly because of what you mentioned in #74. As I understand it, your example is more-obviously a bug than mine, but it's not clear whether we need new language features to handle my example or whether that can be considered a bug, too. The former approach wouldn't be terrible, as it would give us an opportunity to address a cluster of related issues I raised in #32.