title: Swift protocol with "where Self" clause
body: <p>In addition to this syntax with a protocol extension:</p>
  
  <pre><code>protocol P {}
  extension P where Self : UIView {}
  </code></pre>
  
  <p>... I discovered by accident that you can use the same where clause on the protocol itself:</p>
  
  <pre><code>protocol P where Self : UIView {}
  </code></pre>
  
  <p>Notice that this is <em>not</em> the same as a where clause constraining a generic protocol, and does <em>not</em> itself make P a generic protocol.</p>
  
  <p>My experiments seem to show that only a colon can be used here, and the thing after the colon must be a class or a protocol (which may be generic).</p>
  
  <p>I became curious: how did this escape my notice? So I went hunting for evidence of when it arose. In Swift 3.0, the former syntax is legal but <em>not</em> the latter. In Swift 3.3, both are legal. So the latter syntax must have been quietly introduced in something like Swift 3.2. I say "quietly" because I can't find anything about it in the release notes.</p>
  
  <p>What is the second syntax for? Is it, as it appears, just a convenient way of making sure no other type can adopt this protocol? The Swift headers do not seem to make any use of it.</p>