[#88925] [Ruby trunk Feature#15095] [PATCH] share VM stack between threads and fibers if identical — ko1@...
Issue #15095 has been updated by ko1 (Koichi Sasada).
4 messages
2018/09/09
[#88927] Re: [Ruby trunk Feature#15095] [PATCH] share VM stack between threads and fibers if identical
— Eric Wong <normalperson@...>
2018/09/09
[email protected] wrote:
[#88926] [Ruby trunk Feature#15095] [PATCH] share VM stack between threads and fibers if identical — ko1@...
Issue #15095 has been updated by ko1 (Koichi Sasada).
3 messages
2018/09/09
[#89218] [Ruby trunk Bug#15130] open-uri hangs on cygwin — duerst@...
SXNzdWUgIzE1MTMwIGhhcyBiZWVuIHVwZGF0ZWQgYnkgZHVlcnN0IChNYXJ0aW4gRMO8cnN0KS4K
5 messages
2018/09/30
[ruby-core:88977] [Ruby trunk Feature#15113] Show warnings on unused blocks with Enumerable#all? any? one? none?
From:
fursich0@...
Date:
2018-09-13 07:05:55 UTC
List:
ruby-core #88977
Issue #15113 has been reported by fursich (Onishi Koji).
----------------------------------------
Feature #15113: Show warnings on unused blocks with Enumerable#all? any? one? none?
https://bugs.ruby-lang.org/issues/15113
* Author: fursich (Onishi Koji)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Let Array#any? (and related enumerable methods alike) to express warnings in case blocks are left unused.
**Background**
Certain methods in Array silently ignore the given blocks without any warnings, which sometimes causes 'invisible' bugs that are a bit hard to detect.
~~~ ruby
>> [1,2,3].any?(2) {|it| it > 10}
=> true
~~~
On the other hand, Array#index warns you (kindly enough!) when your blocks are left unused.
~~~ ruby
>> [1,2,3].index(2) {|it| it > 10}
(irb):3: warning: given block not used
=> 1
~~~
**Proposal**
This PR is to let Enumerable#all?, #any?, #one, #none? (including similar methods with Array and Hash) to show warning messages so as that it behaves in consistent manner with what we see with Array#index.
**Implementation**
https://github.com/ruby/ruby/pull/1953
Adding one conditional branch per one method call, which would cost very low in terms of computational cost. (benchmark-driver suggested somewhere around 1.00x-1.01x slower with Enumurator#any?)
Hopefully it would help reduce some of the unnecessary source of pain, and help us code happily;)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>