title: Why does Ruby constant lookup sometimes fail when using :: notation?
body: <p>If I have the following modules:</p>
  <pre><code>module Foo
  end
  
  module Foo::Bar
    def print
      puts &quot;something&quot;
    end
  end
  </code></pre>
  <p>Why does this usage style work?</p>
  <pre><code>module Foo
    class Baz
      include Bar
    end
  end
  
  Foo::Baz.new.print
  </code></pre>
  <p>But this usage style errors with &quot;uninitialized constant Foo::Baz::Bar (NameError)&quot;?</p>
  <pre><code>class Foo::Baz
    include Bar
  end
  
  Foo::Baz.new.print
  </code></pre>
  <p>Isn't the second usage case just shorthand for the first one?</p>