ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:53159] [ruby-trunk - Feature #8026][Open] Need Module#prepended_modules
@ 2013-03-06  3:40 marcandre (Marc-Andre Lafortune)
  2013-07-27  5:47 ` [ruby-core:56216] [ruby-trunk - Feature #8026] " matz (Yukihiro Matsumoto)
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: marcandre (Marc-Andre Lafortune) @ 2013-03-06  3:40 UTC (permalink / raw)
  To: ruby-core


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

----------------------------------------
Feature #8026: Need Module#prepended_modules
https://bugs.ruby-lang.org/issues/8026

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


We should have a way to get the list of prepended modules of a class or module.

    module Mixin
    end

    module Outer
      prepend Mixin
    end

    Mixin.prepended_modules   #=> []
    Outer.prepended_modules   #=> [Mixin]

See also bug #8025.


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

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

* [ruby-core:56216] [ruby-trunk - Feature #8026] Need Module#prepended_modules
  2013-03-06  3:40 [ruby-core:53159] [ruby-trunk - Feature #8026][Open] Need Module#prepended_modules marcandre (Marc-Andre Lafortune)
@ 2013-07-27  5:47 ` matz (Yukihiro Matsumoto)
  2013-07-27  6:27 ` [ruby-core:56222] " knu (Akinori MUSHA)
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: matz (Yukihiro Matsumoto) @ 2013-07-27  5:47 UTC (permalink / raw)
  To: ruby-core


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


I am OK with the idea.

Matz.

----------------------------------------
Feature #8026: Need Module#prepended_modules
https://bugs.ruby-lang.org/issues/8026#change-40704

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


We should have a way to get the list of prepended modules of a class or module.

    module Mixin
    end

    module Outer
      prepend Mixin
    end

    Mixin.prepended_modules   #=> []
    Outer.prepended_modules   #=> [Mixin]

See also bug #8025.


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

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

* [ruby-core:56222] [ruby-trunk - Feature #8026] Need Module#prepended_modules
  2013-03-06  3:40 [ruby-core:53159] [ruby-trunk - Feature #8026][Open] Need Module#prepended_modules marcandre (Marc-Andre Lafortune)
  2013-07-27  5:47 ` [ruby-core:56216] [ruby-trunk - Feature #8026] " matz (Yukihiro Matsumoto)
@ 2013-07-27  6:27 ` knu (Akinori MUSHA)
  2013-08-30 23:29 ` [ruby-core:56899] " marcandre (Marc-Andre Lafortune)
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: knu (Akinori MUSHA) @ 2013-07-27  6:27 UTC (permalink / raw)
  To: ruby-core


Issue #8026 has been updated by knu (Akinori MUSHA).


What about adding Module#prepend?(other) also, which could be implemented in ruby as follows?

module Module
  def prepend?(other)
    ancestors.find { |mod|
      break false if mod == self
      mod == other
    }
  end
end

----------------------------------------
Feature #8026: Need Module#prepended_modules
https://bugs.ruby-lang.org/issues/8026#change-40710

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


We should have a way to get the list of prepended modules of a class or module.

    module Mixin
    end

    module Outer
      prepend Mixin
    end

    Mixin.prepended_modules   #=> []
    Outer.prepended_modules   #=> [Mixin]

See also bug #8025.


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

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

* [ruby-core:56899] [ruby-trunk - Feature #8026] Need Module#prepended_modules
  2013-03-06  3:40 [ruby-core:53159] [ruby-trunk - Feature #8026][Open] Need Module#prepended_modules marcandre (Marc-Andre Lafortune)
  2013-07-27  5:47 ` [ruby-core:56216] [ruby-trunk - Feature #8026] " matz (Yukihiro Matsumoto)
  2013-07-27  6:27 ` [ruby-core:56222] " knu (Akinori MUSHA)
@ 2013-08-30 23:29 ` marcandre (Marc-Andre Lafortune)
  2013-08-31  6:00 ` [ruby-core:56917] [ruby-trunk - Feature #8026][Feedback] " matz (Yukihiro Matsumoto)
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marcandre (Marc-Andre Lafortune) @ 2013-08-30 23:29 UTC (permalink / raw)
  To: ruby-core


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

File prepended.pdf added

Slide added. I'm also proposing an optional flag to search only the receiver and not the ancestors.

I didn't put in `prepend?` but it should also be added. On the other hand, `Array.prepend?(Enumerable)` should return false, no?
----------------------------------------
Feature #8026: Need Module#prepended_modules
https://bugs.ruby-lang.org/issues/8026#change-41444

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


We should have a way to get the list of prepended modules of a class or module.

    module Mixin
    end

    module Outer
      prepend Mixin
    end

    Mixin.prepended_modules   #=> []
    Outer.prepended_modules   #=> [Mixin]

See also bug #8025.


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

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

* [ruby-core:56917] [ruby-trunk - Feature #8026][Feedback] Need Module#prepended_modules
  2013-03-06  3:40 [ruby-core:53159] [ruby-trunk - Feature #8026][Open] Need Module#prepended_modules marcandre (Marc-Andre Lafortune)
                   ` (2 preceding siblings ...)
  2013-08-30 23:29 ` [ruby-core:56899] " marcandre (Marc-Andre Lafortune)
@ 2013-08-31  6:00 ` matz (Yukihiro Matsumoto)
  2014-01-30  6:16 ` [ruby-core:60283] [ruby-trunk - Feature #8026] " shibata.hiroshi
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: matz (Yukihiro Matsumoto) @ 2013-08-31  6:00 UTC (permalink / raw)
  To: ruby-core


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

Status changed from Open to Feedback

I basically accept the idea.

But according to the slide, the optional `include_ancestors` is true, but it does mean cherry-picking prepended modules from ancestor list.  I cannot think of any use case of this behavior.

Matz.


----------------------------------------
Feature #8026: Need Module#prepended_modules
https://bugs.ruby-lang.org/issues/8026#change-41468

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


We should have a way to get the list of prepended modules of a class or module.

    module Mixin
    end

    module Outer
      prepend Mixin
    end

    Mixin.prepended_modules   #=> []
    Outer.prepended_modules   #=> [Mixin]

See also bug #8025.


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

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

* [ruby-core:60283] [ruby-trunk - Feature #8026] Need Module#prepended_modules
  2013-03-06  3:40 [ruby-core:53159] [ruby-trunk - Feature #8026][Open] Need Module#prepended_modules marcandre (Marc-Andre Lafortune)
                   ` (3 preceding siblings ...)
  2013-08-31  6:00 ` [ruby-core:56917] [ruby-trunk - Feature #8026][Feedback] " matz (Yukihiro Matsumoto)
@ 2014-01-30  6:16 ` shibata.hiroshi
  2019-12-20  0:51 ` [ruby-core:96347] [Ruby master Feature#8026] " mame
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: shibata.hiroshi @ 2014-01-30  6:16 UTC (permalink / raw)
  To: ruby-core

Issue #8026 has been updated by Hiroshi SHIBATA.

Target version changed from 2.1.0 to current: 2.2.0

----------------------------------------
Feature #8026: Need Module#prepended_modules
https://bugs.ruby-lang.org/issues/8026#change-44765

* Author: Marc-Andre Lafortune
* Status: Feedback
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* Category: core
* Target version: current: 2.2.0
----------------------------------------
We should have a way to get the list of prepended modules of a class or module.

    module Mixin
    end

    module Outer
      prepend Mixin
    end

    Mixin.prepended_modules   #=> []
    Outer.prepended_modules   #=> [Mixin]

See also bug #8025.

---Files--------------------------------
prepended.pdf (99.4 KB)


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

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

* [ruby-core:96347] [Ruby master Feature#8026] Need Module#prepended_modules
  2013-03-06  3:40 [ruby-core:53159] [ruby-trunk - Feature #8026][Open] Need Module#prepended_modules marcandre (Marc-Andre Lafortune)
                   ` (4 preceding siblings ...)
  2014-01-30  6:16 ` [ruby-core:60283] [ruby-trunk - Feature #8026] " shibata.hiroshi
@ 2019-12-20  0:51 ` mame
  2019-12-20  1:03 ` [ruby-core:96350] " mame
  2020-01-16  6:12 ` [ruby-core:96889] " matz
  7 siblings, 0 replies; 9+ messages in thread
From: mame @ 2019-12-20  0:51 UTC (permalink / raw)
  To: ruby-core

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


matz (Yukihiro Matsumoto) wrote:
> But according to the slide, the optional `include_ancestors` is true, but it does mean cherry-picking prepended modules from ancestor list.  I cannot think of any use case of this behavior.

I guess `include_ancestors` here means "modules prepended by prepended modules":

```
module A; end
module B; prepend A; end
module C; prepend B; end

C.prepended_modules(true)  #=> [A, B]
C.prepended_modules(false) #=> [B]
```

So, `include_ancestors` is not a good name; should it be called `include_descendants`?

@marcandre , am I right?

----------------------------------------
Feature #8026: Need Module#prepended_modules
https://bugs.ruby-lang.org/issues/8026#change-83258

* Author: marcandre (Marc-Andre Lafortune)
* Status: Feedback
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
We should have a way to get the list of prepended modules of a class or module.

    module Mixin
    end

    module Outer
      prepend Mixin
    end

    Mixin.prepended_modules   #=> []
    Outer.prepended_modules   #=> [Mixin]

See also bug #8025.

---Files--------------------------------
prepended.pdf (99.4 KB)


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

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

* [ruby-core:96350] [Ruby master Feature#8026] Need Module#prepended_modules
  2013-03-06  3:40 [ruby-core:53159] [ruby-trunk - Feature #8026][Open] Need Module#prepended_modules marcandre (Marc-Andre Lafortune)
                   ` (5 preceding siblings ...)
  2019-12-20  0:51 ` [ruby-core:96347] [Ruby master Feature#8026] " mame
@ 2019-12-20  1:03 ` mame
  2020-01-16  6:12 ` [ruby-core:96889] " matz
  7 siblings, 0 replies; 9+ messages in thread
From: mame @ 2019-12-20  1:03 UTC (permalink / raw)
  To: ruby-core

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


Now I'm unsure if the feature is worth adding.  It was accepted six years ago, but not implemented yet.  I've never heard any actual trouble due to the lack.

----------------------------------------
Feature #8026: Need Module#prepended_modules
https://bugs.ruby-lang.org/issues/8026#change-83261

* Author: marcandre (Marc-Andre Lafortune)
* Status: Feedback
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
We should have a way to get the list of prepended modules of a class or module.

    module Mixin
    end

    module Outer
      prepend Mixin
    end

    Mixin.prepended_modules   #=> []
    Outer.prepended_modules   #=> [Mixin]

See also bug #8025.

---Files--------------------------------
prepended.pdf (99.4 KB)


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

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

* [ruby-core:96889] [Ruby master Feature#8026] Need Module#prepended_modules
  2013-03-06  3:40 [ruby-core:53159] [ruby-trunk - Feature #8026][Open] Need Module#prepended_modules marcandre (Marc-Andre Lafortune)
                   ` (6 preceding siblings ...)
  2019-12-20  1:03 ` [ruby-core:96350] " mame
@ 2020-01-16  6:12 ` matz
  7 siblings, 0 replies; 9+ messages in thread
From: matz @ 2020-01-16  6:12 UTC (permalink / raw)
  To: ruby-core

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


I am still OK with the idea (but not for ancestors). `prepended_module` should list direct prepended modules for the receiver.

Matz.


----------------------------------------
Feature #8026: Need Module#prepended_modules
https://bugs.ruby-lang.org/issues/8026#change-83901

* Author: marcandre (Marc-Andre Lafortune)
* Status: Feedback
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
We should have a way to get the list of prepended modules of a class or module.

    module Mixin
    end

    module Outer
      prepend Mixin
    end

    Mixin.prepended_modules   #=> []
    Outer.prepended_modules   #=> [Mixin]

See also bug #8025.

---Files--------------------------------
prepended.pdf (99.4 KB)


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

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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-06  3:40 [ruby-core:53159] [ruby-trunk - Feature #8026][Open] Need Module#prepended_modules marcandre (Marc-Andre Lafortune)
2013-07-27  5:47 ` [ruby-core:56216] [ruby-trunk - Feature #8026] " matz (Yukihiro Matsumoto)
2013-07-27  6:27 ` [ruby-core:56222] " knu (Akinori MUSHA)
2013-08-30 23:29 ` [ruby-core:56899] " marcandre (Marc-Andre Lafortune)
2013-08-31  6:00 ` [ruby-core:56917] [ruby-trunk - Feature #8026][Feedback] " matz (Yukihiro Matsumoto)
2014-01-30  6:16 ` [ruby-core:60283] [ruby-trunk - Feature #8026] " shibata.hiroshi
2019-12-20  0:51 ` [ruby-core:96347] [Ruby master Feature#8026] " mame
2019-12-20  1:03 ` [ruby-core:96350] " mame
2020-01-16  6:12 ` [ruby-core:96889] " matz

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).