[#86787] [Ruby trunk Feature#14723] [WIP] sleepy GC — ko1@...

Issue #14723 has been updated by ko1 (Koichi Sasada).

13 messages 2018/05/01
[#86790] Re: [Ruby trunk Feature#14723] [WIP] sleepy GC — Eric Wong <normalperson@...> 2018/05/01

ko1@atdot.net wrote:

[#87095] [Ruby trunk Feature#14767] [PATCH] gc.c: use monotonic counters for objspace_malloc_increase — ko1@...

Issue #14767 has been updated by ko1 (Koichi Sasada).

9 messages 2018/05/17
[#87096] Re: [Ruby trunk Feature#14767] [PATCH] gc.c: use monotonic counters for objspace_malloc_increase — Eric Wong <normalperson@...> 2018/05/17

ko1@atdot.net wrote:

[ruby-core:87057] [Ruby trunk Feature#14763] Allow more Enumerable methods to accept method names as symbol arguments

From: sawadatsuyoshi@...
Date: 2018-05-16 04:39:42 UTC
List: ruby-core #87057
Issue #14763 has been updated by sawa (Tsuyoshi Sawada).


I think `reduce` or `inject` taking a method name as an argument was convenient in the old days when symbol to proc was not available. Today, you can just add an ampersand in front of the method name.

Why can't you just add an ampersand in front of the method name? It is not of a big deal.

----------------------------------------
Feature #14763: Allow more Enumerable methods to accept method names as symbol arguments
https://bugs.ruby-lang.org/issues/14763#change-72017

* Author: sunnyrjuneja (Sunny Juneja)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Enumerable has a short hand which accepts method names as symbols.

```ruby
(5..10).reduce(:+) #=> 45
```
I'm proposing we allow the same functionality for #any?, #all?, #find, #reject, #select, #one?, #find_index. I'm requesting this because when I did this earlier today and it did not meet my expectations:

```ruby
[2,4,6].all?(:even?) #=> false
```

* Any risk of incompatibility?
I don't believe so. As of now, #any? accepts an argument and compares using ===. The following is current behavior:

```ruby
[Symbol].any?(:even?) #=> false
[:symbol].any?(:even?) #=> false
[].all?(:even?) #=> true
```

Thanks for consideration of this request. I've used Ruby for 6 years and this is my first feature request. I understand if it is not a high priority or interesting to the maintainers. I am happy to try to add an implementation if it is interesting.



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

In This Thread

Prev Next