Forum: Ruby-core [ruby-trunk - Feature #7394][Open] Enumerable#find ifnone parameter could be non-callable

Posted by zzak (Zachary Scott) (Guest)
on 2012-11-19 04:37
(Received via mailing list)
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
Posted by mame (Yusuke Endoh) (Guest)
on 2012-11-24 03:05
(Received via mailing list)
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
Posted by mame (Yusuke Endoh) (Guest)
on 2012-11-24 03:09
(Received via mailing list)
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
Posted by zzak (Zachary Scott) (Guest)
on 2012-11-24 04:16
(Received via mailing list)
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
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.