title: Why can Dart's built-in List interface be instantiated?
body: <blockquote>
    <p><strong>Notice:</strong> This question is obsolete; the <code>interface</code> declaration syntax has been removed from Dart:</p>
    
    <ul>
    <li><p><a href="http://news.dartlang.org/2012/06/proposal-to-eliminate-interface.html" rel="nofollow">Proposal to eliminate interface declarations from Dart
    </a><br>
    <em>"In Dart, every class engenders an implicit interface.  Now that this feature is implemented, it is possible to actually eliminate interface declarations from the language. Interface declarations are replaced by purely abstract classes."</em></p></li>
    <li><p><a href="https://code.google.com/p/dart/issues/detail?id=3972" rel="nofollow">Issue 3972:    Remove interface declaration support in VM</a></p></li>
    </ul>
  </blockquote>
  
  <hr>
  
  <p>As far as I've been able to tell, it's impossible to instantiate an interface in <a href="http://www.dartlang.org/" rel="nofollow">Dart</a>. If I simply try to construct a <code>new MyInterface()</code>, with or without a constructor defined, I get a run-time error (<a href="http://try-dart-lang.appspot.com/s/O8IW" rel="nofollow">try it</a>):</p>
  
  <pre class="lang-none prettyprint-override"><code>NoSuchMethodException - receiver: '' function name: 'MyInterface$$Factory' arguments: []]
  </code></pre>
  
  <pre><code>interface MyInterface {}      
  </code></pre>
  
  <pre><code>interface MyInterface {
    MyInterface();
  }
  </code></pre>
  
  <p>If I try to use a factory constructor instead, returning an instance of an implementation, I get a compile-time error (<a href="http://try-dart-lang.appspot.com/s/RG8X" rel="nofollow">try it</a>):</p>
  
  <pre class="lang-none prettyprint-override"><code>SyntaxError: factory members are not allowed in interfaces
  </code></pre>
  
  <pre><code>class MyImplementation implements MyInterface {
    MyImplementation();
   }
  
  interface MyInterface {
    factory MyInterface() { return new MyImplementation(); }
  }
  </code></pre>
  
  <p>However, this seems at-odds with the reality that <code>List&lt;E&gt;</code><sup>1</sup> in Dart's core library is an interface<sup>2</sup>, yet it has several constructors and can be instantiated. For example, this works fine (<a href="http://try-dart-lang.appspot.com/s/nK0U" rel="nofollow">try it</a>):</p>
  
  <pre><code>main() {
    var list = new List();
    list.add(5);
    print(list.last());
  }
  </code></pre>
  
  <p>Why can <code>List</code> and many other built-in interfaces be instantiated? Is there some method I missed or are they just receiving special treatment as built-in types?</p>
  
  <hr>
  
  <p><sup>1</sup> <a href="http://www.dartlang.org/docs/api/List.html" rel="nofollow">Dart: Libraries: corelib: interface List&lt;E&gt;</a><br>
  <sup>2</sup> "Much of the Dart Core Library is defined in terms of interfaces."<sup>3</sup><br>
  <sup>3</sup> <a href="http://www.dartlang.org/docs/getting-started/interface.html" rel="nofollow">Dart: Tutorial: Interfaces</a></p>