Issue #8298 has been updated by matz (Yukihiro Matsumoto).

Status changed from Open to Rejected

This is official restriction on module mix-in.

(1) modifications to modules after they are included would not be change existing relation, thus N will not be included to C.
(2) #include does not add already included modules, thus M will not be included to c.singleton_method (but N will be).
(3) #ancestors on a singleton classes does not show the singleton class itself.

The last one might be considered as a bug.  But we have no plan to fix others.

Matz.



----------------------------------------
Bug #8298: Module include inconsistency
https://bugs.ruby-lang.org/issues/8298#change-39040

Author: Student (Nathan Zook)
Status: Rejected
Priority: Normal
Assignee: 
Category: core
Target version: current: 2.1.0
ruby -v: 1.8, 1.9, 2.0
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


It has been suggested that I report this as a violation of the object model:

module M ; end
module N ; end
class C ; include M ; end
module M ; include N ; end
c = C.new
c.extend M
d = class << c ; self ; end
d.ancestors
=>[N, C, M, Object, Kernel]

This has been this way for a while...




-- 
http://bugs.ruby-lang.org/