Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Ruby 1.9 - When Will It be Production Ready

Ruby 1.9 - When Will It be Production Ready

Ruby 1.9 was released on Christmas Day of 2007 as version 1.9.0, after undergoing a year or so as an experimental testbed for changes to the Ruby language and core class library.

Some Rubyists, who took the release as a signal to jump on the new version of Ruby, discovered that existing Ruby code was breaking due to the intentional incompatibilities between the 1.8 and 1.9 versions of the language. This quickly became a topic of discussion on the ruby-talk list.

The real problem is that the reason for the release of Ruby 1.9.0 and its relationship to Ruby 1.8 was not well understood by some of the early adopters in the Ruby community. Matz was fairly clear in postings to the ruby-core list in the months leading up to the release culminating in a note on the day before Christmas containing the following:
  • The release version will be 1.9.0, not 1.9.1 as we have announced before. This denotes the fact it is not as stable as we expected. But the all incompatible changes are done already.
  • THE 1.9 IS INCOMPATIBLE. YOUR APPLICATION MAY NOT WORK AS IT IS. The porting know-how (or porting tools maybe) will not provided as of the first release.
Unfortunately this wasn't part of his official announcement of the release on ruby-talk.

Dave Thomas gave his opinion about how to view and use Ruby 1.9 in a blog article written immediately after the 1.9.0 release. His recommendation, is to install Ruby 1.9 alongside Ruby 1.8 and start checking your existing code for compatibility with an eye towards adapting it for compatibility with Ruby 1.9.

Quite recently, when asked for a prediction of when Ruby 1.9 would reach production status, Matz said:
We don't know. We REALLY hope it comes soon. But there are so many variables involved. Only good news is 1.9 spec is almost fixed at the last Christmas.
In addition to finalizing the specification, using Ruby 1.9 for production depends on having a 1.9 compatible version of whatever infrastructure code is needed by a particular Ruby application. Ruby 1.9 compatibility is underway by the Rails core team, and various developers of gems and plugins are starting to work on it as well, which is the real point of the 1.9.0 release.

Some of these developers are documenting the impact of Ruby 1.9 on their code. Two good posts in this vein are Sam Ruby's description of the changes to REXML to make it compatible, and James Edward Gray II's similar article about a similar effort for FasterCSV which has replaced the old CSV implementation in the Ruby 1.9 standard library. The latter article has generated a valuable list of comments as other chip in with experiences and advice, a sampling:
  • Ruby 1.9 has eliminated using ":" as a shorthand for the then keyword in if, unless and case statements.
  • Several reflection methods like instance_variables, and constants now return arrays of symbols instead of strings.
  • Indexing a string "abc"[0] now returns a single character string rather than an integer.
  • The definition of Enumerable#zip has changed in two ways. Calling it without a block argument now returns an enumerator instead of an array, and where in Ruby 1.8 [1, 2, 3].zip(%w{a b}) would produce [[1,'a'], [2, 'b'], [3, nil]] in Ruby 1.9 the result, actually the result of [1, 2, 3].zip(%w{a b}).to_a due to the first change, is [[1,'a'], [2, 'b']] as extra elements in the receiver are skipped. This has been the subject of some discussion on the ruby-core mailing list and it seems likely one or both of these changes might get backed out before the 1.9 specification finalizes.
Ruby 1.9 presents choices to users of some of the more esoteric features of Ruby. Some features, such as continuations have been moved out of the core and are now part of the standard library.

In addition, Ruby 1.9 provides improved support for writing proxy objects. Prior to Ruby 1.9, several third-party ruby libraries used Jim Weirich's BlankSlate class or a derivative, in order to get a minimal class with fewer methods than Object so that most methods will trigger the method_missing hook. BlankSlate removes a lot of inherited methods programmatically. Ruby 1.9 has a new BasicObject class which implements a minimal set of methods (!, !=, ==, equal?, singleton_method_added, singleton_method_removed, and singleton_method_undefined). This simplifies writing proxy classes. On the other hand, there's been some discussion on ruby-core that a few more methods, like instance_eval, might be needed as well.

In conclusion, Ruby 1.9 is still a work in progress, a development rather than production version of the language. The release of 1.9.0 is providing an impetus to the community to look at the 'new' Ruby much more seriously, but it will be a while until Ruby 1.9 and the community are really ready to use it for most production uses. Quoting Dave Thomas:
That's one of the great things about Matz releasing 1.9 as a development release: we all get a lot of time to handle the migration.

Rate this Article