Conversation
tenderlove
left a comment
There was a problem hiding this comment.
Looks good, but should we implement it in Ruby?
|
I though about that way. I suppose it's just: def fetch_values(*indexes, &block)
indexes.map { |i| fetch(i, &block) }
end |
|
Since it's a new method, clearly it's not a bottleneck in anyone's app. We could make a primitive call for |
|
Yeah, my concern isn't so much performance but more about potentially yielding at an unexpected point or some other very subtle behavior issues. And also just consistency with But yeah, this method doesn't exactly cry hotspot. |
The good part about implementing it from the beginning in Ruby is that if people complain about speed we can rewrite in C (or tell them to use YJIT). 😂 |
|
The commit message is wrong, |
[Feature #20702] Works the same way than `Hash#fetch_values` for for array.
e6c1208 to
ffc2013
Compare
|
Corrected. |
|
Merged #11557 instead |
[Feature #20702]
Works the same way than
Hash#fetch_valuesfor for array.