Recursive Madman wrote: > Did you also check what character followed those interpolations? e.g. "#{@foo}bar" wouldn't be a candidate for the shorthand, so that shouldn't be counted. Okay, this time I only counted string interpolation...brianhempel (Brian Hempel)
You’re right there may be some risk for anti-patterns, but from my experience this example in the original proposal is practical: ~~~ruby begin ... rescue => e if e.message == "some error" ...handle error... end ~~~ Sometim...brianhempel (Brian Hempel)
Martin Dürst wrote: > Can you tell us what the situation is for Ruby itself (including build scripts and standard library)? In the ruby/ruby repo, the shorthand is used 115 times, regular is used 12,473 times. (12,473 is all regular ...brianhempel (Brian Hempel)
Recursive Madman wrote: > Did you also check what character followed those interpolations? e.g. "#{@foo}bar" wouldn't be a candidate for the shorthand, so that shouldn't be counted. Good catch: No, I did not. I'll try to get better n...brianhempel (Brian Hempel)
Steve Richert asked me how many of those 353,199 regular interpolations could have been replaced by shorthand interpolations, since most string interpolations will contain a local variable, a method, or a more complicated expression. ...brianhempel (Brian Hempel)
I analyzed the ~150,000 Ruby files in the top 1000 Ruby repositories on GitHub: The regular interpolation syntax is used 353,199 times. The shorthand interpolation syntax is used 1,376 times. In percentages, that's 99.6% vs 0.4%. ...brianhempel (Brian Hempel)
Yes, I would rather see `Hash#map_values` in Ruby before `Enumerable#frequencies`. However, if both `map_values` and `frequencies` were added, then we might not need `relative_frequencies`, since calculating it becomes cleaner: ~~~rub...brianhempel (Brian Hempel)
Thanks for the feedback David. I can see a `map` functionality being useful, but here I will play some arguments against integrating `map`: 1. In the future, I was thinking the block could be used to change the weighting: some element...brianhempel (Brian Hempel)
Counting how many times a value appears in some collection has always been a bit clumsy in Ruby. While Ruby has enough constructs to do it in one line, it still requires knowing the folklore of the optimum solution as well as some acroba...brianhempel (Brian Hempel)