ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:56898] [ruby-trunk - Bug #8841][Open] Module#included_modules and prepended modules
@ 2013-08-30 23:17 marcandre (Marc-Andre Lafortune)
  2019-12-20  0:56 ` [ruby-core:96348] [Ruby master Bug#8841] " mame
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: marcandre (Marc-Andre Lafortune) @ 2013-08-30 23:17 UTC (permalink / raw)
  To: ruby-core


Issue #8841 has been reported by marcandre (Marc-Andre Lafortune).

----------------------------------------
Bug #8841: Module#included_modules and prepended modules
https://bugs.ruby-lang.org/issues/8841

Author: marcandre (Marc-Andre Lafortune)
Status: Open
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor
ruby -v: r42735
Backport: 


The documentation for Module#included_modules currently states "Returns the list of modules included in +mod+."

This was never perfectly accurate, as the list also contains modules included in +mod+'s ancestors.

It now also includes prepended modules.

This is consistent with `include?` that returns true for prepended modules, but not quite consistent with `included` that does not get called for prepended modules.

Matz, could you confirm that current behavior is what you want?

If so, we should fix the documentation of `include?` and `included_modules`.


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:96348] [Ruby master Bug#8841] Module#included_modules and prepended modules
  2013-08-30 23:17 [ruby-core:56898] [ruby-trunk - Bug #8841][Open] Module#included_modules and prepended modules marcandre (Marc-Andre Lafortune)
@ 2019-12-20  0:56 ` mame
  2019-12-20 14:33 ` [ruby-core:96376] " jean.boussier
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mame @ 2019-12-20  0:56 UTC (permalink / raw)
  To: ruby-core

Issue #8841 has been updated by mame (Yusuke Endoh).


Summary:

* `Module#include?` and `Module#included_modules` regard prepended modules as `included` (not well documented)
* `Module#included` is not called when the module is prepended

Is this right?

----------------------------------------
Bug #8841: Module#included_modules and prepended modules
https://bugs.ruby-lang.org/issues/8841#change-83259

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
* ruby -v: r42735
* Backport: 
----------------------------------------
The documentation for Module#included_modules currently states "Returns the list of modules included in +mod+."

This was never perfectly accurate, as the list also contains modules included in +mod+'s ancestors.

It now also includes prepended modules.

This is consistent with `include?` that returns true for prepended modules, but not quite consistent with `included` that does not get called for prepended modules.

Matz, could you confirm that current behavior is what you want?

If so, we should fix the documentation of `include?` and `included_modules`.



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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:96376] [Ruby master Bug#8841] Module#included_modules and prepended modules
  2013-08-30 23:17 [ruby-core:56898] [ruby-trunk - Bug #8841][Open] Module#included_modules and prepended modules marcandre (Marc-Andre Lafortune)
  2019-12-20  0:56 ` [ruby-core:96348] [Ruby master Bug#8841] " mame
@ 2019-12-20 14:33 ` jean.boussier
  2020-01-16  6:19 ` [ruby-core:96891] " matz
  2020-01-16 19:32 ` [ruby-core:96916] " ruby-core
  3 siblings, 0 replies; 5+ messages in thread
From: jean.boussier @ 2019-12-20 14:33 UTC (permalink / raw)
  To: ruby-core

Issue #8841 has been updated by byroot (Jean Boussier).


> Module#included is not called when the module is prepended

I think that's fine, because it calls `Module#prepended`.

> Module#include? and Module#included_modules regard prepended modules as included (not well documented)

That yes:

```ruby
class Base
end

module A
end

module B
end

Base.prepend(A)
Base.include(B)

p Base.included_modules
```

outputs:

```
[A, B, Kernel]
```


----------------------------------------
Bug #8841: Module#included_modules and prepended modules
https://bugs.ruby-lang.org/issues/8841#change-83293

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
* ruby -v: r42735
* Backport: 
----------------------------------------
The documentation for Module#included_modules currently states "Returns the list of modules included in +mod+."

This was never perfectly accurate, as the list also contains modules included in +mod+'s ancestors.

It now also includes prepended modules.

This is consistent with `include?` that returns true for prepended modules, but not quite consistent with `included` that does not get called for prepended modules.

Matz, could you confirm that current behavior is what you want?

If so, we should fix the documentation of `include?` and `included_modules`.



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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:96891] [Ruby master Bug#8841] Module#included_modules and prepended modules
  2013-08-30 23:17 [ruby-core:56898] [ruby-trunk - Bug #8841][Open] Module#included_modules and prepended modules marcandre (Marc-Andre Lafortune)
  2019-12-20  0:56 ` [ruby-core:96348] [Ruby master Bug#8841] " mame
  2019-12-20 14:33 ` [ruby-core:96376] " jean.boussier
@ 2020-01-16  6:19 ` matz
  2020-01-16 19:32 ` [ruby-core:96916] " ruby-core
  3 siblings, 0 replies; 5+ messages in thread
From: matz @ 2020-01-16  6:19 UTC (permalink / raw)
  To: ruby-core

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

Status changed from Open to Closed

This intentional.

Matz.


----------------------------------------
Bug #8841: Module#included_modules and prepended modules
https://bugs.ruby-lang.org/issues/8841#change-83904

* Author: marcandre (Marc-Andre Lafortune)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
* ruby -v: r42735
* Backport: 
----------------------------------------
The documentation for Module#included_modules currently states "Returns the list of modules included in +mod+."

This was never perfectly accurate, as the list also contains modules included in +mod+'s ancestors.

It now also includes prepended modules.

This is consistent with `include?` that returns true for prepended modules, but not quite consistent with `included` that does not get called for prepended modules.

Matz, could you confirm that current behavior is what you want?

If so, we should fix the documentation of `include?` and `included_modules`.



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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:96916] [Ruby master Bug#8841] Module#included_modules and prepended modules
  2013-08-30 23:17 [ruby-core:56898] [ruby-trunk - Bug #8841][Open] Module#included_modules and prepended modules marcandre (Marc-Andre Lafortune)
                   ` (2 preceding siblings ...)
  2020-01-16  6:19 ` [ruby-core:96891] " matz
@ 2020-01-16 19:32 ` ruby-core
  3 siblings, 0 replies; 5+ messages in thread
From: ruby-core @ 2020-01-16 19:32 UTC (permalink / raw)
  To: ruby-core

Issue #8841 has been updated by marcandre (Marc-Andre Lafortune).


Thank you.

I clarified the documentation to reflect this.

----------------------------------------
Bug #8841: Module#included_modules and prepended modules
https://bugs.ruby-lang.org/issues/8841#change-83934

* Author: marcandre (Marc-Andre Lafortune)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
* ruby -v: r42735
* Backport: 
----------------------------------------
The documentation for Module#included_modules currently states "Returns the list of modules included in +mod+."

This was never perfectly accurate, as the list also contains modules included in +mod+'s ancestors.

It now also includes prepended modules.

This is consistent with `include?` that returns true for prepended modules, but not quite consistent with `included` that does not get called for prepended modules.

Matz, could you confirm that current behavior is what you want?

If so, we should fix the documentation of `include?` and `included_modules`.



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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-16 19:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-30 23:17 [ruby-core:56898] [ruby-trunk - Bug #8841][Open] Module#included_modules and prepended modules marcandre (Marc-Andre Lafortune)
2019-12-20  0:56 ` [ruby-core:96348] [Ruby master Bug#8841] " mame
2019-12-20 14:33 ` [ruby-core:96376] " jean.boussier
2020-01-16  6:19 ` [ruby-core:96891] " matz
2020-01-16 19:32 ` [ruby-core:96916] " ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).