The best kittens, technology, and video games blog in the world.

Monday, November 11, 2013

The Great Ruby 2.0 Upgrade

Ragdoll Kitten by jurvetson from flickr (CC-BY)

Here's a quick announcement: I no longer care about Ruby 1.8 and 1.9 compatibility, all my Open Source software (except etwng for the time being, that's targeting JRuby default mode) is just going to assume you're running Ruby 2.0. Most of it will work on 1.9.x as well, and some might even run on 1.8.x, but that's a lucky coincidence, not any conscious effort.

If it inconveniences you greatly, feel free to send patches, I just don't plan to put any effort into this myself. But seriously, you should upgrade (at least to 1.9.x).

Once upon a time Perl 5, Python 2, and Ruby 1.8 all decided to do a major version upgrade. It went very differently for them. To call Perl 6 migration derailed would be an understatement. Python 3 is doing a lot better, but it still struggles, even so many years after 3.0 release most major Python projects still don't support Python 3, or only sort of do. To be honest this surprises me a lot, Perl 6 was obviously doomed from the beginning, but I thought Python people had their act together on this, with converter scripts, compatibility libraries, feature deprecation system, imports from the feature and so on. Apparently all that wasn't enough.

Meanwhile Ruby 2.0 upgrade went amazingly smoothly, with very little amount of backwards compatibility breaking. Pretty much the only nontrivial breakages were removing Pathname#to_str (which breaks Pathname library completely for no good reason since the entire Ruby POSIX interface demands Strings as arguments and doesn't bother to to_s anything) and some Unicode-related brittleness. All other incompatibilies are trivial things that are easy to fix and weren't important in the first place.

And speaking of upgrades, I recently found the first command line option parsing library that I actually liked quite a bit - trollop. I plan to use it pretty extensively, so gem install trollop away!

2 comments:

Eldc said...

What do you think of the idea behind http://docopt.org/ ?

taw said...

Eldc: I've never used it, seems more complex than trollop. I'm not entirely convinced that parsing documentation into executable code is the way to go - Ruby DSLs tend to be pretty good.