InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Ruby 1.9 - When Will It be Production Ready

Posted by Rick DeNatale on Jan 10, 2008

Sections
Development
Topics
Ruby ,
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.
Re: Enumerable#zip semantics by Alex Popescu Posted
  1. Back to top

    Re: Enumerable#zip semantics

    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

Questions for an Enterprise Architect

Erik Dörnenburg answers: What is Enterprise and Evolutionary Architecture?, discussing 4 issues: Turning strategy into execution, Ensuring conformance, Where do the architects sit? Buying or building?

Wrap Your SQL Head Around Riak MapReduce

Sean Cribbs explains what Map-Reduce and Riak are, why and how to use Map-Reduce with Riak, and how to convert SQL queries into their Map-Reduce equivalents.

Polyglot Persistence for Java Developers - Moving Out of the Relational Comfort Zone

Chris Richardson shows how he ported a relational database to three NoSQL data stores: Redis, Cassandra and MongoDB.

The Golden Circle – Why How What

Jean Tabaka challenges the audience to reflect on what Agile practices they are employing, how they are using them, ending with the questions “Why have their organization chosen to go Agile?

The Web Platform as a Limitless Pool of Innovation, with Andreas Gal

Andreas talks about the benefits of the Open Web and how it compares to proprietary stacks. He also talks about various projects that push the envelope like Boot to Gecko, Broadway and pdf.js.

Hadoop and NoSQLin a Big Data Environment

Ron Bodkin discusses early adoption of Hadoop, NoSQL and describes MapReduce and related libraries and Frameworks. Other topics include Hive, Pig, multi tenancy, and security in a big data environment

Spring and Platform Interoperability

Stephen Bohlen explains how Spring helps with interoperability between Java and .NET, demoing it with the help of a sample application.

How to Stop Writing Next Year's Unsustainable Piece of Code

Guilherme Silveira mentions some of the turning points in project development that may affect the quality of the code offering advice on avoiding writing crappy code.