Forum: Ruby-core [ruby-trunk - Bug #8025][Open] Module#included_modules includes classes

Posted by marcandre (Marc-Andre Lafortune) (Guest)
on 2013-03-06 04:39
(Received via mailing list)
Issue #8025 has been reported by marcandre (Marc-Andre Lafortune).

----------------------------------------
Bug #8025: Module#included_modules includes classes
https://bugs.ruby-lang.org/issues/8025

Author: marcandre (Marc-Andre Lafortune)
Status: Open
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: current: 2.1.0
ruby -v: r39608


I see two problems in the following code:

    module Mixin
    end

    class C
      prepend Mixin
    end

    C.included_modules # => [Mixin, C, Kernel]

1) C should definitely not be there, since no class should ever appear 
in that list.

2) I wonder if Mixin should be there, since it was prepended to C, not 
included.
Posted by nagachika (Tomoyuki Chikanaga) (Guest)
on 2013-05-08 17:52
(Received via mailing list)
Issue #8025 has been updated by nagachika (Tomoyuki Chikanaga).

Assignee changed from nagachika (Tomoyuki Chikanaga) to nobu (Nobuyoshi 
Nakada)

Hello,

A problem seems to remain in case of inherited Class was prepended by a 
Module.
See the following sample.


module M1; end

class C1
  prepend M1
end

class C2 < C1
end

p C1.included_modules # => [M1, Kernel]
p C2.included_modules # => [M1, C1, Kernel]

Thanks,
----------------------------------------
Backport #8025: Module#included_modules includes classes
https://bugs.ruby-lang.org/issues/8025#change-39206

Author: marcandre (Marc-Andre Lafortune)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version:


I see two problems in the following code:

    module Mixin
    end

    class C
      prepend Mixin
    end

    C.included_modules # => [Mixin, C, Kernel]

1) C should definitely not be there, since no class should ever appear 
in that list.

2) I wonder if Mixin should be there, since it was prepended to C, not 
included.
Posted by nagachika (Tomoyuki Chikanaga) (Guest)
on 2013-05-09 16:39
(Received via mailing list)
Issue #8025 has been updated by nagachika (Tomoyuki Chikanaga).

Assignee changed from nobu (Nobuyoshi Nakada) to nagachika (Tomoyuki 
Chikanaga)

r40614 is an additional commit. Thank you nobu.
----------------------------------------
Backport #8025: Module#included_modules includes classes
https://bugs.ruby-lang.org/issues/8025#change-39227

Author: marcandre (Marc-Andre Lafortune)
Status: Assigned
Priority: Normal
Assignee: nagachika (Tomoyuki Chikanaga)
Category:
Target version:


I see two problems in the following code:

    module Mixin
    end

    class C
      prepend Mixin
    end

    C.included_modules # => [Mixin, C, Kernel]

1) C should definitely not be there, since no class should ever appear 
in that list.

2) I wonder if Mixin should be there, since it was prepended to C, not 
included.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.