il 26 May 2004 23:49:03 GMT, Philipp Kern <trash / philkern.de> ha scritto:: >Hi Ruby folks. > >It's impossible to me to inherit a class from Struct when the class does not >share its constructor with the Struct superclass. >Struct implements .new on its own, instead of properly implementing it by >initialize, so the following is impossible: then do the same thing :) >> class MyStruct < Struct >> def self.new() Struct.new('Foo',:bar) end >> # optionally define initialize and call it in new()'s result ?> end => nil >> Foo=MyStruct.new => Struct::Foo >> f=Foo.new => #<struct Struct::Foo bar=nil> >> f.bar=10 => 10