I think this or something similar was suggested in the past, even aside from
the two linked in proposals. So this may even be older than 5 years. :)
I do not remember what the conclusion was in all these proposals (and perhaps
I misremember, but I think it was suggested even before those ~5 years, perhaps
in another context).
As for the particular last syntax, I think this is quite inelegant:
ary.map(&(:dig, :id))
Ruby users may feel that both :dig and :id have the same "importance",
since they are symbols, but if I understood it correctly then your
example would imply that dig refers to a method-name, and id refers
to an argument; and to me, if this is the case, this looks ... strange.
But I understand that this was just an example.
I also admit that I often prefer oldschool ruby, so I am biased. :)
Edit: Actually zverok suggested something similar. I believe we should be very
cautious about whether it is needed/necessary. When a feature is added, obviously
people will use it, so all trade-offs should be considered (pro or con).
sawa wrote:
or how it would be superior to writing like:
ary.map { _1.dig(:id) }
Yes, this may be an additional question. But I think _1 _2 and so forth are
more useful when there are more parameters. I found that I actually only
use _1 _2 for quick debugging/writing, and replace it with the "real", longer
name lateron anyway.