title: Extend module & class variable access?
body: <p>I can't understand why accessing module's class variable fails in the following example:</p>
  
  <pre><code>module M
    @@xyz = 123
  end
  M.class_variables    # [:@@xyz]
  M.class_variable_get :@@xyz    # 123 , so far so good
  
  class C
    extend M
  end
  C.singleton_class.class_variables    # [:@@xyz]
  C.singleton_class.class_variable_get :@@xyz # NameError:
                        # uninitialized class variable @@xyz in Class
  </code></pre>
  
  <p>Can anybody explain why the class variable <code>@@xyz</code> is suddenly inacessible/undefined in <code>C</code>'s singleton class?</p>
  
  <p><strong>Update:</strong>
  I re-tested the above code with different Ruby YARV versions and find it as a regression in the latest.</p>
  
  <p><strong>Update 2:</strong></p>
  
  <p>There was a change in definition of <code>Module#class_variables</code> method in latest Ruby generation.</p>
  
  <ul>
  <li><p>Ruby up to 1.9.3 the definition is</p>
  
  <p><a href="http://ruby-doc.org/core-1.9.3/Module.html#method-i-class_variables" rel="nofollow">class_variables</a> → array</p>
  
  <p>Returns an array of the names of class variables in mod.</p></li>
  <li><p>Ruby 2.0.0 latest stable version</p>
  
  <p><a href="http://www.ruby-doc.org/core-2.0/Module.html#method-i-class_variables" rel="nofollow">class_variables(inherit=true)</a> → array</p>
  
  <p>Returns an array of the names of class variables in mod. This
  includes the names of class variables in any included modules,
  unless the inherit parameter is set to false.</p></li>
  </ul>
  
  <p>So in latest Ruby incarnation, <code>class_variables</code> returns by default also class variables of included modules. Just curious what's this feature for or if it still does concern modules "included" with <code>include</code> and not <code>extend</code>.</p>
  
  <p>Can anybody explain ?</p>