From: Charles Thornton Date: 2007-03-23T07:28:51+09:00 Subject: MyBad ==> Re: [ ruby-Bugs-9462 ] BUGS in metaclasses inheritance Charles Thornton wrote: > Rick DeNatale wrote: >> On 3/22/07, Charles Thornton wrote: >> >>> This chart is essentially correct, It simply leaves out a few >>> implementation >>> details. >>> >>> (1) "Object" super entry includes the ObjectSpace Module >> >> Where did that come from? >> >> Object includes Kernel, not ObjectSpace. So that rb_cObject's >> superclass chain should look like: >> >> rb_cObject --> (T_Iclass:Kernel) ---> nil >> >> where T_ICLASS:Kernel has: >> klass = rb_cClass >> iv_tbl = rb_mKernel.iv_tbl >> m_tbl = rb_mKernel.iv_tbl >> >> >> Note also that Object.superclass doesn't always return the value of >> the klass field. It walks the superclass chain and skips past classes >> marked at T_ICLASS which are proxies for included modules. >> > I will look at my dumps again -- But the chart I submitted was > automatically generated by walking through all objects in > ObjectSpace and recording the links as they are implemented > in the Objects that are ACTUALLY there! > > Obviously, while this snapshot was taken after the ruby program > had run (the call to ObjectSpace.my_short_object), It does reflect > the actual state of ObjectSpace at that time. > > I include the program and the ObjectSpace Diagram > JUST A NOTE -- I took out the "test_object" Instance and singleton for the chart -- > > ------------------------------------------------------------------------ > > # > # Simple Test Case for Plot > # > include ObjectSpace > # > # Create Test Class > # > class TestCase > def initialize > end > end > # > # Define a Singleton Class for 'TestCase' > # > #test_object = TestCase.new() > > #def test_object.test_singleton_method() > # puts ("TestCase Singleton Method") > #end > # > # Dump Object Space (ALL Objects - Including Singletons!) > # > ObjectSpace.my_short_object >