From: Trans Date: 2008-03-07T03:32:52+09:00 Subject: Re: Double colon vs module block On Mar 6, 1:21 pm, Daniel Mendler wrote: > Hi! > > I am new to ruby. I have a question concerning namespaces. Is there a > difference between using the double colon operator or a module block? > Example: > > module Library > class Book > end > end > > vs. > > class Library::Book > end The later will give an error if Library isn't yet defined (personally I with is would just auto-instantiate a new module). Also the lookup of constants resolves differently. For example: module Library SOMETHING = "whatever" end class Library::Book SOMETHING #=> NameError: uninitialized constant end But I _think_ this has been fixed in Ruby 1.9... Can someone confirm that? T.