ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:49557] [ruby-trunk - Feature #7394][Open] Enumerable#find ifnone parameter could be non-callable
@ 2012-11-19  3:36 zzak (Zachary Scott)
  2012-11-24  2:02 ` [ruby-core:49963] [ruby-trunk - Feature #7394][Assigned] " mame (Yusuke Endoh)
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zzak (Zachary Scott) @ 2012-11-19  3:36 UTC (permalink / raw)
  To: ruby-core


Issue #7394 has been reported by zzak (Zachary Scott).

----------------------------------------
Feature #7394: Enumerable#find ifnone parameter could be non-callable
https://bugs.ruby-lang.org/issues/7394

Author: zzak (Zachary Scott)
Status: Open
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0


=begin
from github:
https://github.com/ruby/ruby/pull/186

In trunk the Enumerable #find method ifnone parameter has to be callable or nil. I found that sometimes I want to return a simple value without wrapping it in a proc. This pull request adds support for non-callable defaults when no items match.

(({a = [1, 2, 3]}))

The current behavior
(({a.find(proc { :foo }) { |x| x > 3 } #=> :foo}))

With patch
(({a.find(0) { |x| x > 3 } #=> 0}))
=end



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

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

* [ruby-core:49963] [ruby-trunk - Feature #7394][Assigned] Enumerable#find ifnone parameter could be non-callable
  2012-11-19  3:36 [ruby-core:49557] [ruby-trunk - Feature #7394][Open] Enumerable#find ifnone parameter could be non-callable zzak (Zachary Scott)
@ 2012-11-24  2:02 ` mame (Yusuke Endoh)
  2012-11-24  2:09 ` [ruby-core:49966] [ruby-trunk - Feature #7394] " mame (Yusuke Endoh)
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mame (Yusuke Endoh) @ 2012-11-24  2:02 UTC (permalink / raw)
  To: ruby-core


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

Status changed from Open to Assigned
Target version changed from 2.0.0 to next minor

Zachary Scott, please don't add 2.0.0 feature ticket unless I approve.  The 2.0.0 feature deadline was passed.

-- 
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Feature #7394: Enumerable#find ifnone parameter could be non-callable
https://bugs.ruby-lang.org/issues/7394#change-33729

Author: zzak (Zachary Scott)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: next minor


=begin
from github:
https://github.com/ruby/ruby/pull/186

In trunk the Enumerable #find method ifnone parameter has to be callable or nil. I found that sometimes I want to return a simple value without wrapping it in a proc. This pull request adds support for non-callable defaults when no items match.

(({a = [1, 2, 3]}))

The current behavior
(({a.find(proc { :foo }) { |x| x > 3 } #=> :foo}))

With patch
(({a.find(0) { |x| x > 3 } #=> 0}))
=end



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

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

* [ruby-core:49966] [ruby-trunk - Feature #7394] Enumerable#find ifnone parameter could be non-callable
  2012-11-19  3:36 [ruby-core:49557] [ruby-trunk - Feature #7394][Open] Enumerable#find ifnone parameter could be non-callable zzak (Zachary Scott)
  2012-11-24  2:02 ` [ruby-core:49963] [ruby-trunk - Feature #7394][Assigned] " mame (Yusuke Endoh)
@ 2012-11-24  2:09 ` mame (Yusuke Endoh)
  2012-11-24  3:16 ` [ruby-core:49990] " zzak (Zachary Scott)
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mame (Yusuke Endoh) @ 2012-11-24  2:09 UTC (permalink / raw)
  To: ruby-core


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


Oh, I didn't realized that this ticket was from github pull reqeust.
Thank you for your importing work!
But, the fact remains that this proposal was not accepted by the 2.0.0 deadline.  Sorry.

It is unfortunate that people misunderstands that github pullreq is the right way to request a feature to Ruby.
Is it impossible to stop (or automatically reject) pullreq?

-- 
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Feature #7394: Enumerable#find ifnone parameter could be non-callable
https://bugs.ruby-lang.org/issues/7394#change-33732

Author: zzak (Zachary Scott)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: next minor


=begin
from github:
https://github.com/ruby/ruby/pull/186

In trunk the Enumerable #find method ifnone parameter has to be callable or nil. I found that sometimes I want to return a simple value without wrapping it in a proc. This pull request adds support for non-callable defaults when no items match.

(({a = [1, 2, 3]}))

The current behavior
(({a.find(proc { :foo }) { |x| x > 3 } #=> :foo}))

With patch
(({a.find(0) { |x| x > 3 } #=> 0}))
=end



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

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

* [ruby-core:49990] [ruby-trunk - Feature #7394] Enumerable#find ifnone parameter could be non-callable
  2012-11-19  3:36 [ruby-core:49557] [ruby-trunk - Feature #7394][Open] Enumerable#find ifnone parameter could be non-callable zzak (Zachary Scott)
  2012-11-24  2:02 ` [ruby-core:49963] [ruby-trunk - Feature #7394][Assigned] " mame (Yusuke Endoh)
  2012-11-24  2:09 ` [ruby-core:49966] [ruby-trunk - Feature #7394] " mame (Yusuke Endoh)
@ 2012-11-24  3:16 ` zzak (Zachary Scott)
  2019-02-13 22:06 ` [ruby-core:91536] [Ruby trunk Feature#7394] " samuel
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zzak (Zachary Scott) @ 2012-11-24  3:16 UTC (permalink / raw)
  To: ruby-core


Issue #7394 has been updated by zzak (Zachary Scott).


This was during my import of patches from github to redmine.

You can turn off pull requests on github, maybe start a new thread to discuss that.
----------------------------------------
Feature #7394: Enumerable#find ifnone parameter could be non-callable
https://bugs.ruby-lang.org/issues/7394#change-33759

Author: zzak (Zachary Scott)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: next minor


=begin
from github:
https://github.com/ruby/ruby/pull/186

In trunk the Enumerable #find method ifnone parameter has to be callable or nil. I found that sometimes I want to return a simple value without wrapping it in a proc. This pull request adds support for non-callable defaults when no items match.

(({a = [1, 2, 3]}))

The current behavior
(({a.find(proc { :foo }) { |x| x > 3 } #=> :foo}))

With patch
(({a.find(0) { |x| x > 3 } #=> 0}))
=end



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

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

* [ruby-core:91536] [Ruby trunk Feature#7394] Enumerable#find ifnone parameter could be non-callable
  2012-11-19  3:36 [ruby-core:49557] [ruby-trunk - Feature #7394][Open] Enumerable#find ifnone parameter could be non-callable zzak (Zachary Scott)
                   ` (2 preceding siblings ...)
  2012-11-24  3:16 ` [ruby-core:49990] " zzak (Zachary Scott)
@ 2019-02-13 22:06 ` samuel
  2019-02-13 22:08 ` [ruby-core:91537] " samuel
  2019-02-14  4:44 ` [ruby-core:91542] " nobu
  5 siblings, 0 replies; 7+ messages in thread
From: samuel @ 2019-02-13 22:06 UTC (permalink / raw)
  To: ruby-core

Issue #7394 has been updated by ioquatix (Samuel Williams).


Can we merge this?

----------------------------------------
Feature #7394: Enumerable#find ifnone parameter could be non-callable
https://bugs.ruby-lang.org/issues/7394#change-76793

* Author: zzak (Zachary Scott)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
----------------------------------------
=begin
from github:
https://github.com/ruby/ruby/pull/186

In trunk the Enumerable #find method ifnone parameter has to be callable or nil. I found that sometimes I want to return a simple value without wrapping it in a proc. This pull request adds support for non-callable defaults when no items match.

(({a = [1, 2, 3]}))

The current behavior
(({a.find(proc { :foo }) { |x| x > 3 } #=> :foo}))

With patch
(({a.find(0) { |x| x > 3 } #=> 0}))
=end


---Files--------------------------------
enumerable_find_noncallable.patch (3.45 KB)


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

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

* [ruby-core:91537] [Ruby trunk Feature#7394] Enumerable#find ifnone parameter could be non-callable
  2012-11-19  3:36 [ruby-core:49557] [ruby-trunk - Feature #7394][Open] Enumerable#find ifnone parameter could be non-callable zzak (Zachary Scott)
                   ` (3 preceding siblings ...)
  2019-02-13 22:06 ` [ruby-core:91536] [Ruby trunk Feature#7394] " samuel
@ 2019-02-13 22:08 ` samuel
  2019-02-14  4:44 ` [ruby-core:91542] " nobu
  5 siblings, 0 replies; 7+ messages in thread
From: samuel @ 2019-02-13 22:08 UTC (permalink / raw)
  To: ruby-core

Issue #7394 has been updated by ioquatix (Samuel Williams).


Just because it might cause some surprise, perhaps we can use keyword argument for this.

e.g.

```ruby
a = [1, 2, 3]
a.find(else: 0) { |x| x > 3 } #=> 0
```

I kind of prefer original suggestion, but I can imagine if passing an object that responds to `#call` it might have unexpected behaviour.

----------------------------------------
Feature #7394: Enumerable#find ifnone parameter could be non-callable
https://bugs.ruby-lang.org/issues/7394#change-76794

* Author: zzak (Zachary Scott)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
----------------------------------------
=begin
from github:
https://github.com/ruby/ruby/pull/186

In trunk the Enumerable #find method ifnone parameter has to be callable or nil. I found that sometimes I want to return a simple value without wrapping it in a proc. This pull request adds support for non-callable defaults when no items match.

(({a = [1, 2, 3]}))

The current behavior
(({a.find(proc { :foo }) { |x| x > 3 } #=> :foo}))

With patch
(({a.find(0) { |x| x > 3 } #=> 0}))
=end


---Files--------------------------------
enumerable_find_noncallable.patch (3.45 KB)


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

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

* [ruby-core:91542] [Ruby trunk Feature#7394] Enumerable#find ifnone parameter could be non-callable
  2012-11-19  3:36 [ruby-core:49557] [ruby-trunk - Feature #7394][Open] Enumerable#find ifnone parameter could be non-callable zzak (Zachary Scott)
                   ` (4 preceding siblings ...)
  2019-02-13 22:08 ` [ruby-core:91537] " samuel
@ 2019-02-14  4:44 ` nobu
  5 siblings, 0 replies; 7+ messages in thread
From: nobu @ 2019-02-14  4:44 UTC (permalink / raw)
  To: ruby-core

Issue #7394 has been updated by nobu (Nobuyoshi Nakada).

Description updated

Currently, it is not able to distinguish from the case a hash is given as an ordinal argument.
So there still is a possibility to break a compatibility.

----------------------------------------
Feature #7394: Enumerable#find ifnone parameter could be non-callable
https://bugs.ruby-lang.org/issues/7394#change-76805

* Author: zzak (Zachary Scott)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
----------------------------------------
from github:
https://github.com/ruby/ruby/pull/186

In trunk the `Enumerable#find` method `ifnone` parameter has to be callable or `nil`. I found that sometimes I want to return a simple value without wrapping it in a proc. This pull request adds support for non-callable defaults when no items match.

```ruby
a = [1, 2, 3]
```

The current behavior

```ruby
a.find(proc { :foo }) { |x| x > 3 } #=> :foo
```

With patch

```ruby
a.find(0) { |x| x > 3 } #=> 0
```


---Files--------------------------------
enumerable_find_noncallable.patch (3.45 KB)


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

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

end of thread, other threads:[~2019-02-14  4:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-19  3:36 [ruby-core:49557] [ruby-trunk - Feature #7394][Open] Enumerable#find ifnone parameter could be non-callable zzak (Zachary Scott)
2012-11-24  2:02 ` [ruby-core:49963] [ruby-trunk - Feature #7394][Assigned] " mame (Yusuke Endoh)
2012-11-24  2:09 ` [ruby-core:49966] [ruby-trunk - Feature #7394] " mame (Yusuke Endoh)
2012-11-24  3:16 ` [ruby-core:49990] " zzak (Zachary Scott)
2019-02-13 22:06 ` [ruby-core:91536] [Ruby trunk Feature#7394] " samuel
2019-02-13 22:08 ` [ruby-core:91537] " samuel
2019-02-14  4:44 ` [ruby-core:91542] " nobu

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