InfoQ

News

Ruby 1.9 - When Will It be Production Ready

Posted by Rick DeNatale on Jan 10, 2008 06:00 PM

Community
Ruby
Topics
Language,
Runtimes
Tags
Metaprogramming
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.

2 comments

Reply

Enumerable#zip semantics by dddq dddq Posted Jan 11, 2008 4:55 AM
Re: Enumerable#zip semantics by Alex Popescu Posted Jan 12, 2008 4:46 AM
  1. Back to top

    Enumerable#zip semantics

    Jan 11, 2008 4:55 AM by dddq dddq

    The semantics of Enumerable#zip have been changed back to be mostly like 1.8 in trunk already. This means that the 1.9.0 tag has semantics that will never be in any other version of Ruby. Pretty unusable if you ask me, even for test purposes. :( PS. The stupid infoq comment login popup defeats FF's remember password feature.

  2. Back to top

    Re: Enumerable#zip semantics

    Jan 12, 2008 4:46 AM by Alex Popescu

    dddq feel free to drop me an email with your suggestions to improve the in-place login functionality. I would be more than happy to have your feedback and suggestions. bests, ./alex -- .w( the_mindstorm )p. Alexandru Popescu Senior Software Eng. InfoQ Techlead/Co-founder

Exclusive Content

Getting Started with Grails

Jason Rudolph discusses Java/Grails integration, Grails plugins, creating a Grails sample application, Grails app structure, data querying and persistence, validation, controllers and tag libraries.

Creating Product Owner Success

The Scrum Product Owner role is powerful, valuable and challenging to implement. It brings healthier relationships between customers and developers, and competitive advantage - if you do it right.

Book Excerpt and Interview: Effective Java, Second Edition

Effective Java, Second Edition by Joshua Bloch is an updated version of the classic first edition, which won a 2001 Jolt Award. InfoQ asked Bloch questions about the areas that the new edition covers.

Tapestry for Nonbelievers

A new article by I. Drobiazko and R. Zubairov introduces v. 5 of the Apache Tapestry component-oriented web framework. The tutorial shows how to create a component and covers IoC in Tapestry and Ajax.

Pete Lacey on REST and Web Services

In this interview, Burton Group consultant Pete Lacey talks to Stefan Tilkov about his disillusionment with SOAP, his opinion on REST, and addresses some of the perceived shortcomings REST vs. WS-*.

Business Natural Languages Development in Ruby

Jay Fields presents his concept of Business Natural Languages - a type of Domain Specific Languages geared towards being readable by domain experts.

Distributed Version Control Systems: A Not-So-Quick Guide Through

Adoption and interest for Distributed Version Control Systems is constantly rising. We will introduce the concept of DVCS and have a look at 3 actors in the area: git, Mercurial and Bazaar.

Segundo Velasquez and Agile as Seen Through the Customer's Eyes

Deborah Hartmann interviewed Segundo Velasquez about his experience as customer with an Agile team during the initial phase of software design of a product.