On Tue, 15 Feb 2005 23:06:37 +0900, Jeremy Tregunna
<jtregunna / blurgle.ca> wrote:
> On 15-Feb-05, at 8:54 AM, centrepins / gmail.com wrote:
> > In Why's guide, I see the line:
> > File::open( ...etc.
> >
> > Up 'til now I've always written this as:
> >
> > File.open( ...etc.
> >
> > (ie. using a . rather than a ::).  Am I right in thinking the :: for
> > accessing class methods is now old-style?
> Foo::bar is for accessing "bar" (be it a method or class or whatever)
> in the module "Foo". Foo.bar wants "bar" in class "Foo".

Mmm. Not really. I can do this, just fine:

  module FooMod
    def self.bar; puts "FooMod.bar"; end
  end

  FooMod.bar
  FooMod::bar

The difference between :: and . is that :: is used to access constants
or methods and . is used exclusively to access methods. For fun, try
doing:

  "foo"::length

-austin
-- 
Austin Ziegler * halostatue / gmail.com
               * Alternate: austin / halostatue.ca