Project

General

Profile

Bug #9573

Updated by nobu (Nobuyoshi Nakada) over 10 years ago

```ruby 
 module Mod1 
 end 

 module Mod2 
 end 

 class Class1 
 end 

 class Class2 < Class1 
 end 

 p Class2.ancestors - Object.ancestors # [Class2, Class1] 

 Class1.include Mod1 

 p Class2.ancestors - Object.ancestors # [Class2, Class1, Mod1] 

 Mod1.include Mod2 

 p Mod1.ancestors - Object.ancestors # [Mod1, Mod2] 

 p Class2.ancestors - Object.ancestors # [Class2, Class1, Mod1] 
 ``` 
 ________________________________________________________________ 

 note that descendants of a class do gain its future ancestors 

 so 2 issues: 

 1. It would seem natural that in dynamic language, dynamically added ancestors should propagate to descendants 
 2. Why is there a difference in ancestor propagation between modules and classes 
 

Back