Issue #16667 has been updated by sawa (Tsuyoshi Sawada).


I am not sure how allowing parameters to `Symbol#to_proc` and `Method#to_pr=
oc` would make:

```ruby
ary.map(:dig.to_proc(:id))
```

possible as `Array#map` does not take an argument. What do you want it to r=
eturn?


Needless to say, it is entirely unclear how that, if possible, would replac=
e:

```ruby
ary.map { |e| e.dig(:id) }
```

or how it is superior to writing like:

```ruby
ary.map { _1.dig(:id) }
```


----------------------------------------
Feature #16667: Allow parameters to Symbol#to_proc and Method#to_proc
https://bugs.ruby-lang.org/issues/16667#change-84443

* Author: jgomo3 (Jes=FAs G=F3mez)
* Status: Open
* Priority: Normal
----------------------------------------
Allow parameters to Symbol#to_proc and Method#to_proc

So we can say:

``` ruby
ary.map(:dig.to_proc(:id))
```


Instead of

``` ruby
ary.map { |e| e.dig(:id) }
```


Oppening the posibilities to refine the `&` operator in the future, for som=
ething like:


``` ruby
ary.map(&(:dig, :id))
```

Related:

* https://bugs.ruby-lang.org/issues/11161
* https://bugs.ruby-lang.org/issues/16435



-- =

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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>