From: Chris Pine Date: 2003-01-14T05:29:08+09:00 Subject: trouble understanding const_set() Hello, I'm trying to understand why the following code is giving me an error. It seems like it isn't finding Foo::Constant (which doesn't exist), but why isn't it looking for Bar::Constant, instead? As you can see, `self' is Bar, not Foo: irb(main):001:0> class Foo irb(main):002:1> def Foo.foo irb(main):003:2> const_set 'Constant', 'just a string' irb(main):004:2> puts self.inspect irb(main):005:2> puts Constant irb(main):006:2> end irb(main):007:1> end nil irb(main):008:0> class Bar < Foo irb(main):009:1> end nil irb(main):010:0> Bar.foo Bar NameError: uninitialized constant Constant at Foo from (irb):5:in `foo' from (irb):10 irb(main):011:0> Bar::Constant "just a string" Any help would be much appreciated, Chris