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


This is a serious breakage, in fact, breaks Rails. So I believe we need to change this soon. But:

* We need more time to investigate
* We don't have much time before the release
* Rails made a patch to address this issue

Thus fix this after the 3.0 release.

Matz.



----------------------------------------
Bug #17423: `Prepend` should prepend a module before the class
https://bugs.ruby-lang.org/issues/17423#change-89493

* Author: matz (Yukihiro Matsumoto)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
I see

```ruby
module M; end
module A; end
class B; include A; end

A.prepend M
B.prepend M
p B.ancestors
```

gives `[B, M, A, Object, Kernel, BasicObject]` now. It used to be `[M, B, A, Object, Kernel, BasicObject]`.

I think it should be prepended to class `B`. Probably it should be `[M, B, M, A, Object, Kernel, BasicObject]`.

The reason behind this change may be duplication removing, but considering the following code, it is OK to duplicate prepende modules.

```ruby
module M; end
class A; end
class B<A; end

A.prepend M
B.prepend M
p B.ancestors # => [M, B, M, A, Object, Kernel, BasicObject]
```

Am I missing something?

Matz.






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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>