[#82311] [Ruby trunk Bug#13794] Infinite loop of sched_yield — charlie@...
Issue #13794 has been reported by catphish (Charlie Smurthwaite).
4 messages
2017/08/09
[#82518] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — mame@...
Issue #13618 has been updated by mame (Yusuke Endoh).
5 messages
2017/08/30
[#82552] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2017/08/31
mame@ruby-lang.org wrote:
[#82756] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wrong <normalperson@...>
2017/09/12
Eric Wrong <normalperson@yhbt.net> wrote:
[ruby-core:82360] [Ruby trunk Feature#13807] A method to filter the receiver against some condition
From:
duerst@...
Date:
2017-08-12 10:05:08 UTC
List:
ruby-core #82360
Issue #13807 has been updated by duerst (Martin D端rst).
I don't see any improvement. The new way that would be possible with the `verify` method is longer and more complicated than the simple and straightforward `a.some_condition ? a : b`.
----------------------------------------
Feature #13807: A method to filter the receiver against some condition
https://bugs.ruby-lang.org/issues/13807#change-66157
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
I frequently see code that uses some value if that value satisfies a certain condition, and something else otherwise.
```ruby
a.some_condition ? a : b
```
And in most cases, the value of `a` is non-nil when the condition is satisfied.
I propose to have a method, perhaps named `verify`, which would implemented to be equivalent to this definition:
```ruby
class Object
def verify
self if yield(self)
end
end
```
Then, we can write the expression above (assuming `a` is non-nil when the condition is satisfied) like this:
```ruby
a.verify{|a| a.some_condition} || b
```
Perhaps it would also be useful to do something like:
```ruby
a.verify{|a| a.some_condition}&.chaining_of_more_methods
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>