From: leon breedt Date: 2005-03-01T12:19:35+09:00 Subject: Re: structuring complexly-interdependent C/Ruby libraries On Tue, 1 Mar 2005 00:50:29 +0900, Eric Peden wrote: > This was suggested by several people (thanks, Pit and Leon!), and not > only captures the essence of Ruby, but would work quite well... if it > weren't for my need for inheritance, as you point out shortly. I > _could_ also create "empty" versions of my superclasses in C, but then > I'm recreating the inheritance hierarchy again. Or... I'm not sure you need to recreate it: class Super end class Test < Super def one puts "one!" end end t1 = Test.new class Test def two puts "two!" end end t2 = Test.new puts t1.class.ancestors.inspect puts t2.class.ancestors.inspect It appears that Ruby "remembers" the ancestry from the first time that class was defined using that name. So if you define it in C first, and in your Ruby code, require the extension before redefining the classes, you don't need to recreate the inheritance hierarchy. Leon