[ruby-core:77610] [Ruby trunk Bug#12834] `prepend` getting prepended even if it already exists in the ancestors chain

From: ndnenkov@...
Date: 2016-10-13 10:48:32 UTC
List: ruby-core #77610
Issue #12834 has been reported by Nikola Nenkov.

----------------------------------------
Bug #12834: `prepend` getting prepended even if it already exists in the ancestors chain
https://bugs.ruby-lang.org/issues/12834

* 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: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next