ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:68214] [Ruby trunk - Feature #10880] [Open] Subclassing Array from Enumerator
       [not found] <redmine.issue-10880.20150221200433@ruby-lang.org>
@ 2015-02-21 20:04 ` sawadatsuyoshi
  2015-02-22  2:24 ` [ruby-core:68221] [Ruby trunk - Feature #10880] " ruby-core
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: sawadatsuyoshi @ 2015-02-21 20:04 UTC (permalink / raw)
  To: ruby-core

Issue #10880 has been reported by Tsuyoshi Sawada.

----------------------------------------
Feature #10880: Subclassing Array from Enumerator
https://bugs.ruby-lang.org/issues/10880

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
It often happens that I want to use a method from the `Enumerator` class on an array, and so I frequently use `Array#to_enum`. Since `Array` and `Enumerator` share the same parent `Enumerable`, they should be very close. I think it would be convenient if `Array` inherits from `Enumerator`. (Perhaps the same thing can be said for `Hash` too)



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

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

* [ruby-core:68221] [Ruby trunk - Feature #10880] Subclassing Array from Enumerator
       [not found] <redmine.issue-10880.20150221200433@ruby-lang.org>
  2015-02-21 20:04 ` [ruby-core:68214] [Ruby trunk - Feature #10880] [Open] Subclassing Array from Enumerator sawadatsuyoshi
@ 2015-02-22  2:24 ` ruby-core
  2015-02-22  5:14 ` [ruby-core:68224] " sawadatsuyoshi
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: ruby-core @ 2015-02-22  2:24 UTC (permalink / raw)
  To: ruby-core

Issue #10880 has been updated by Marc-Andre Lafortune.


> they should be very close

They *are* very close:

    Enumerator.instance_methods - Array.instance_methods
    # => [:with_index, :with_object, :next_values, :peek_values, :next, :peek, :feed, :rewind] 

Which method(s) in there do you claim to use frequently?

----------------------------------------
Feature #10880: Subclassing Array from Enumerator
https://bugs.ruby-lang.org/issues/10880#change-51582

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
It often happens that I want to use a method from the `Enumerator` class on an array, and so I frequently use `Array#to_enum`. Since `Array` and `Enumerator` share the same parent `Enumerable`, they should be very close. I think it would be convenient if `Array` inherits from `Enumerator`. (Perhaps the same thing can be said for `Hash` too)



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

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

* [ruby-core:68224] [Ruby trunk - Feature #10880] Subclassing Array from Enumerator
       [not found] <redmine.issue-10880.20150221200433@ruby-lang.org>
  2015-02-21 20:04 ` [ruby-core:68214] [Ruby trunk - Feature #10880] [Open] Subclassing Array from Enumerator sawadatsuyoshi
  2015-02-22  2:24 ` [ruby-core:68221] [Ruby trunk - Feature #10880] " ruby-core
@ 2015-02-22  5:14 ` sawadatsuyoshi
  2015-02-22 15:09 ` [ruby-core:68227] " ruby-core
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: sawadatsuyoshi @ 2015-02-22  5:14 UTC (permalink / raw)
  To: ruby-core

Issue #10880 has been updated by Tsuyoshi Sawada.


Marc-Andre Lafortune wrote:
> 
>     Enumerator.instance_methods - Array.instance_methods
>     # => [:with_index, :with_object, :next_values, :peek_values, :next, :peek, :feed, :rewind] 
> 
> Which method(s) in there do you claim to use frequently?

I use `with_index` and `with_object` frequently.

----------------------------------------
Feature #10880: Subclassing Array from Enumerator
https://bugs.ruby-lang.org/issues/10880#change-51585

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
It often happens that I want to use a method from the `Enumerator` class on an array, and so I frequently use `Array#to_enum`. Since `Array` and `Enumerator` share the same parent `Enumerable`, they should be very close. I think it would be convenient if `Array` inherits from `Enumerator`. (Perhaps the same thing can be said for `Hash` too)



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

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

* [ruby-core:68227] [Ruby trunk - Feature #10880] Subclassing Array from Enumerator
       [not found] <redmine.issue-10880.20150221200433@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2015-02-22  5:14 ` [ruby-core:68224] " sawadatsuyoshi
@ 2015-02-22 15:09 ` ruby-core
  2015-02-22 15:13 ` [ruby-core:68228] " sawadatsuyoshi
  2020-01-04 18:54 ` [ruby-core:96661] [Ruby master Feature#10880] " sawadatsuyoshi
  5 siblings, 0 replies; 6+ messages in thread
From: ruby-core @ 2015-02-22 15:09 UTC (permalink / raw)
  To: ruby-core

Issue #10880 has been updated by Marc-Andre Lafortune.


> I use with_index and with_object frequently.

Any reason why you wouldn't simply use `each_with_index` and `each_with_object`?

----------------------------------------
Feature #10880: Subclassing Array from Enumerator
https://bugs.ruby-lang.org/issues/10880#change-51589

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
It often happens that I want to use a method from the `Enumerator` class on an array, and so I frequently use `Array#to_enum`. Since `Array` and `Enumerator` share the same parent `Enumerable`, they should be very close. I think it would be convenient if `Array` inherits from `Enumerator`. (Perhaps the same thing can be said for `Hash` too)



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

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

* [ruby-core:68228] [Ruby trunk - Feature #10880] Subclassing Array from Enumerator
       [not found] <redmine.issue-10880.20150221200433@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2015-02-22 15:09 ` [ruby-core:68227] " ruby-core
@ 2015-02-22 15:13 ` sawadatsuyoshi
  2020-01-04 18:54 ` [ruby-core:96661] [Ruby master Feature#10880] " sawadatsuyoshi
  5 siblings, 0 replies; 6+ messages in thread
From: sawadatsuyoshi @ 2015-02-22 15:13 UTC (permalink / raw)
  To: ruby-core

Issue #10880 has been updated by Tsuyoshi Sawada.


Marc-Andre Lafortune wrote:
> > I use with_index and with_object frequently.
> 
> Any reason why you wouldn't simply use `each_with_index` and `each_with_object`?

I want to provide an optional starting number (most often `1`) to the former.

----------------------------------------
Feature #10880: Subclassing Array from Enumerator
https://bugs.ruby-lang.org/issues/10880#change-51590

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
It often happens that I want to use a method from the `Enumerator` class on an array, and so I frequently use `Array#to_enum`. Since `Array` and `Enumerator` share the same parent `Enumerable`, they should be very close. I think it would be convenient if `Array` inherits from `Enumerator`. (Perhaps the same thing can be said for `Hash` too)



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

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

* [ruby-core:96661] [Ruby master Feature#10880] Subclassing Array from Enumerator
       [not found] <redmine.issue-10880.20150221200433@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2015-02-22 15:13 ` [ruby-core:68228] " sawadatsuyoshi
@ 2020-01-04 18:54 ` sawadatsuyoshi
  5 siblings, 0 replies; 6+ messages in thread
From: sawadatsuyoshi @ 2020-01-04 18:54 UTC (permalink / raw)
  To: ruby-core

Issue #10880 has been updated by sawa (Tsuyoshi Sawada).


I should use `each_with_index` and `each_with_object` as marcandre suggests. I withdraw this. Please close this issue.

----------------------------------------
Feature #10880: Subclassing Array from Enumerator
https://bugs.ruby-lang.org/issues/10880#change-83631

* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
It often happens that I want to use a method from the `Enumerator` class on an array, and so I frequently use `Array#to_enum`. Since `Array` and `Enumerator` share the same parent `Enumerable`, they should be very close. I think it would be convenient if `Array` inherits from `Enumerator`. (Perhaps the same thing can be said for `Hash` too)



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

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

end of thread, other threads:[~2020-01-04 18:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-10880.20150221200433@ruby-lang.org>
2015-02-21 20:04 ` [ruby-core:68214] [Ruby trunk - Feature #10880] [Open] Subclassing Array from Enumerator sawadatsuyoshi
2015-02-22  2:24 ` [ruby-core:68221] [Ruby trunk - Feature #10880] " ruby-core
2015-02-22  5:14 ` [ruby-core:68224] " sawadatsuyoshi
2015-02-22 15:09 ` [ruby-core:68227] " ruby-core
2015-02-22 15:13 ` [ruby-core:68228] " sawadatsuyoshi
2020-01-04 18:54 ` [ruby-core:96661] [Ruby master Feature#10880] " sawadatsuyoshi

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