title: Any type and implementing generic list in go programming language
body: <p>I'm trying a little of <a href="http://golang.org" rel="nofollow">go programming language</a>.</p>
  
  <p>I'm a excited about the simplicity of the Go, but after playing with it I met some troubles.</p>
  
  <p>1 . I know that <em>Go</em> doesn't support generics and inheritance. <b>Is there any way to implement generic list?</b></p>
  
  <p>I thinking about using:</p>
  
  <pre><code>type Any interface { }
  </code></pre>
  
  <p>but how can I check if the value is NULL.<br />
  I'm looking for some equivalent implementation to C
  </p>
  
  <pre><code>struct List {
    List* tail;
    void* head;
  }
  </code></pre>
  
  <p>Or using algebraic datatype:
  </p>
  
  <pre><code>data List a = Nil | Cons a (List a)
  </code></pre>
  
  <p><br/>
  2 . More advanced requirement would be to <b>make some container for objects with a field of a particular type?</b><br />
  For example in <em>Scala programming language</em> I can type:
  </p>
  
  <pre><code>val List[Animal { type SuitableFood = Grass} ]
  </code></pre>
  
  <p>to get a <code>List</code> of <code>Animals</code>, which have a member type <code>SuitableFood</code> which is <code>Grass</code></p>