rc3.org

Strong opinions, weakly held

Programmers should study a little economics

So the big news on Twitter among Ruby programmers is that the “hashrocket” operator has been deprecated. For those of you who aren’t Ruby programmers, here’s what that means. If you want to declare a hash literal in Ruby, right now you can do it like this:

my_hash = { :foo => "1", :bar => "2" }

Also, many methods accept hash literals as an argument, so you can do things like this:

url_for :controller => 'posts', :action => 'index'

At some point, that notation will be unsupported, and hash literals will have to declared in a different way.

When the version of Ruby is released that doesn’t support this notation, it will be incompatible with a massive amount of Ruby code. My advice to the Ruby developers would be not to do it. I don’t know what the rationale is for removing it, but the result is going to be lots and lots of servers that are simply never upgraded to that version of Ruby.

They should take a lesson from the PHP people. The migration from PHP 4 to PHP 5 has taken forever as a result of much smaller incompatibilities than this one.

Economics tells us that we have to be careful about the incentives that result from our actions. Removing the hashrocket operator creates a strong incentive to leave the Ruby upgrade path.

Update: Sometimes rumors on Twitter are just rumors on Twitter. I don’t see any mention of deprecating the => operator in the Ruby Subversion repository.

2 Comments

  1. But compare with the stuff that chromatic has been ranting about WRT Perl, where there are some incredibly crufty things that have been left around for a long time in the name of not breaking legacy code — insuring that new code that uses those crufty interfaces will get written…

Leave a Reply

Your email address will not be published.

*

© 2024 rc3.org

Theme by Anders NorenUp ↑