title: Circular dependency with generics
body: <p>I have defined the following interface:</p>
  
  <pre><code>public interface IStateSpace&lt;State, Action&gt;
  where State : IState
  where Action : IAction&lt;State, Action&gt; // &lt;-- this is the line that bothers me
  {
      void SetValueAt(State state, Action action);
      Action GetValueAt(State state);
  }
  </code></pre>
  
  <p>Basically, an <code>IStateSpace</code> interface should be something like a chess board, and in each position of the chess board you have a set of possible movements to do. Those movements here are called <code>IAction</code>s. I have defined this interface this way so I can accommodate for different implementations: I can then define concrete classes that implement 2D matrix, 3D matrix, graphs, etc.</p>
  
  <pre><code>public interface IAction&lt;State, Action&gt; {
      IStateSpace&lt;State, Action&gt; StateSpace { get; }
  }
  </code></pre>
  
  <p>An <code>IAction</code>, would be to move up(this is, if in <code>(2, 2)</code> move to <code>(2, 1)</code>), move down, etc.
  Now, I'll want that each action has access to a StateSpace so it can do some checking logic. Is this implementation correct? Or is this a bad case of a circular dependence? If yes, how to accomplish "the same" in a different way?</p>
  
  <p>Thanks</p>