Let's Simplify Ruby
I love Ruby, but there are a lot of things that are in the language I’ve never used.
For example, did you know about the “flip flop operator”?
(1..20).each do |x| puts x if (x == 5) .. (x == 10) end
I certainly didn’t, and nobody in our office had seen or used it.
Yesterday, Steve wrote about the shorthand string interpolation syntax. Nobody in our office had heard about this until maybe a year ago, and none use it.
Today, I am suggesting we deprecate
each_with_index from Ruby. Why? Because we now have
with_index that you can chain with
select and more!
each_with_index was redundant as I was teaching Ruby. Lots of people ask if there’s a
map_with_index or similar. If you start by teaching people
each.with_index (note the
. instead of
_) they will guess they can use it with
map and instinctively know they can do more.
Another great idea is to extract REXML out of Ruby and into a gem.
I think Ruby can benefit from removing some things. We all benefit from a simpler language, and while it will never get as small as I might want, we should always think about what we could live without.
So what else can we remove? I have a few more ideas, but I’d love to hear your suggestions (and I expect some of you to think I’m nuts).
If you have good ideas, submit them as issues to Ruby and start the discussion. We may not get to simplify as much as we want, but it is important to talk about it.
 Thanks to Richard Schneeman for prodding me to submit issues instead of complaining.