From: zn@... Date: 2016-10-13T15:26:01+00:00 Subject: [ruby-core:77613] [Ruby trunk Bug#12834] `prepend` getting prepended even if it already exists in the ancestors chain Issue #12834 has been updated by Kazuhiro NISHIYAMA. `Module#include` can make multiple times module existence in `ancestors`. ```ruby module M; end class A; end class B < A; include M; end class A; include M; end B.ancestors #=> [B, M, A, M, Object, Kernel, BasicObject] ``` ---------------------------------------- Bug #12834: `prepend` getting prepended even if it already exists in the ancestors chain https://bugs.ruby-lang.org/issues/12834#change-60881 * Author: Nikola Nenkov * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.3.1 * Backport: 2.3: UNKNOWN ---------------------------------------- ``` module M; end class A; prepend M; end class B < A; prepend M; end B.ancestors # => [M, B, M, A, Object, Kernel, BasicObject] ``` Even though I find this behaviour to be more intuitive, it is inconsistent with `Module#include` and is potentially breaking. I didn't see a mention on the [[release notes]](https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released/) and the [[documentation]](https://ruby-doc.org/core-2.3.1/Module.html#method-i-prepend_features) is now outdated. -- https://bugs.ruby-lang.org/ Unsubscribe: