Project

General

Profile

Actions

Bug #17423

closed

`Prepend` should prepend a module before the class

Added by matz (Yukihiro Matsumoto) over 3 years ago. Updated about 3 years ago.

Status:
Closed
Target version:
-
[ruby-core:<unknown>]

Description

I see

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.

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.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #7844: include/prepend satisfiable module dependencies are not satisfiedClosedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0