From: Jim Freeze Date: 2005-05-01T11:02:19+09:00 Subject: Re: instantiating metaclasses, sorta [Was: determining when inside 'class << self'] * Christoph [2005-05-01 09:34:08 +0900]: > Jim Freeze schrieb: > > >I've always considered duping as a nice way of erasing the 'specialness' > >of an object while returning it to its natural state. > > > > > It's true that duping erases class method for general > objects - it's FALSE for Module objects! > > --- > module A > def self.bla > puts "bla" > end > end > > A.dup.bla # bla I'm not sure I understand your point here. A typical use is below: irb(main):001:0> module M irb(main):002:1> def fred; "fred"; end irb(main):003:1> end => nil irb(main):004:0> class C; end => nil irb(main):005:0> c = C.new => # irb(main):006:0> c.extend M => # irb(main):007:0> c.fred => "fred" irb(main):008:0> c = c.dup => # irb(main):009:0> c.fred NoMethodError: undefined method `fred' for # from (irb):9 from :0 But, if you have module methods and extended an object, what would be the point? How do module methods show up in extended objects? I thought they didn't. -- Jim Freeze Code Red. Code Ruby