From: theschof@... (TheSchof) Date: 2002-01-18T12:57:48+09:00 Subject: Re: Can we use constant for a method name? >It's allowed. The only difference is > > Foo::Bar > >is not considered as method call. You have to put argument >parenthesises explicitly. > > matz. I'm not sure why this works though: irb(main):001:0> def Meth irb(main):002:1> puts 'from capitalized method' irb(main):003:1> end nil irb(main):004:0> self::Meth from capitalized method nil or what's going on here: irb(main):005:0> class C irb(main):006:1> def Meth irb(main):007:2> puts 'from C' irb(main):008:2> end irb(main):009:1> end nil irb(main):010:0> C.Meth NameError: private method `Meth' called for C:Class from (irb):10 irb(main):011:0> C::Meth NameError: uninitialized constant Meth at C from (irb):11 irb(main):012:0> C::Meth() NameError: private method `Meth' called for C:Class from (irb):12 irb(main):013:0> class C irb(main):014:1> def C.Meth irb(main):015:2> puts 'from C 2nd attempt' irb(main):016:2> end irb(main):017:1> end nil irb(main):018:0> C.Meth from C 2nd attempt nil I thought capitalized names became class constants automatically, but is it different for methods?