InfoQ

News

Ruby 1.9 - When Will It be Production Ready

Posted by Rick DeNatale on Jan 10, 2008

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

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.