Does the order of P1 and P2 matter in: extension P1 where Self: P2?

Going back to the specific topic of this thread: If the order of P1 and P2 is intended to be truly irrelevant in:

extension P1 where Self: P2 { /* ... */ }

then perhaps it would be more clear if this could be expressed like this:

extension P1 & P2 { /* ... */ }

Unless there are reasons why that wouldn't make sense?


For more than two protocols, it would simply be:

extension P1 & P2 & P3 { /* ... */ }

which in today's syntax has to be:

extension P1 where Self: P2 & P3 { /* ... */ }

or, if acting as if & wasn't allowed in this context either:

extension P1 where Self: P2, Self: P3 { /* ... */ }

EDIT:

From my naive perspective, and despite being aware of the Dunning-Kruger effect, I have to say that It seems like much of the stuff related to type aliases, associated types, extensions (constrained, conditional etc) is an entangled mess that can't be tackled piecemeal / iteratively. If decisions and changes will be based solely on Swift Evolution and core team discussions without a common understanding of the intended over-all system, it seems to me like this mess can at best change shape, if not increase.

2 Likes