General

Profile

brianhempel (Brian Hempel)

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 1 0 1

Activity

12/05/2014

02:58 AM Ruby Misc #10541: Remove shorthand string interpolation syntax
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)

12/04/2014

04:38 PM Ruby Feature #10481: Add "if" and "unless" clauses to rescue statements
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)

12/01/2014

02:11 PM Ruby Misc #10541: Remove shorthand string interpolation syntax
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)
02:03 PM Ruby Misc #10541: Remove shorthand string interpolation syntax
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)
04:53 AM Ruby Misc #10541: Remove shorthand string interpolation syntax
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)

11/30/2014

08:16 PM Ruby Misc #10541: Remove shorthand string interpolation syntax
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)

11/28/2014

08:38 AM Ruby Feature #10552: [PATCH] Add Enumerable#frequencies and Enumerable#relative_frequencies
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)

11/27/2014

07:29 PM Ruby Feature #10552: [PATCH] Add Enumerable#frequencies and Enumerable#relative_frequencies
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)
07:59 AM Ruby Feature #10552 (Open): [PATCH] Add Enumerable#frequencies and Enumerable#relative_frequencies
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)

Also available in: Atom