title: At runtime, how does Swift know which implementation to use?
body: <pre><code>protocol A {
      func f()
  }
  
  struct S1 : A {
      func f() {
          print("S1")
      }
  }
  
  struct S2 : A {
      func f() {
          print("S2")
      }
  }
  
  let array: [A] = [S1(), S2()]
  
  for s: A in array {
      s.f()
  }
  
  // "S1\n" "S2\n"
  </code></pre>
  
  <p>If this was an inheritance hierarchy, I would expect Swift to use a v-table to look up the correct implementation. However, the concrete types in <code>array</code> could be anything that implements <code>A</code>, along with any number of other protocols, so how would the Swift runtime know the structure of the object if it was also using v-tables?</p>