Feeds

Ruby 2.0.0 adds syntax sparkle, boosts performance

First major stable release in five years

The Power of One eBook: Top reasons to choose HP BladeSystem

The Ruby community announced the first stable release of Ruby 2.0 on Sunday, exactly 20 years to the day since Ruby creator Yukihiro "Matz" Matsumoto first conceived of the language on February 24, 1993.

Ruby 2.0.0-p0, as the release is formally known, represents the first major revision of the language since Ruby 1.9 was released in December 2007. The most recent entry in the 1.9 line, Ruby 1.9.3, was released on October 31, 2011.

Although the full list of changes since Ruby 1.9.3 is fairly long, Ruby 2.0.0 is essentially an incremental release, one that maintains nearly full backward compatibility with the previous version.

In fact, according to the language's maintainers, most developers will find it much easier to migrate from Ruby 1.9 to Ruby 2.0 than it was to move from Ruby 1.8 to Ruby 1.9.

Among the language changes in the new release are the ability to pass arguments to methods as named keywords; new syntax that makes it easier to create arrays of symbols; and Module#prepend, a way to allow methods loaded from a module to override those in a class.

The default character encoding for Ruby scripts has been changed from US-ASCII to UTF-8, which can cause problems with some older scripts but eliminates the need to use magic comments to declare UTF-8 encoding in modern programs.

Refinements, another new feature that improves how modules can be used to extend core classes – a practice known as "monkey-patching" among the Ruby community – is present in Ruby 2.0.0, but it's still considered experimental. Its specification may yet change in future releases, so it's not recommended for everyday use.

Changes to the Ruby core libraries in 2.0.0 include a new, more powerful regular expression engine; a new API for asynchronous exception handling; and "lazy" methods for the Enumerator and Range classes and the Enumerable module that delay evaluation of expressions until their values are needed.

A number of optimizations have been made to the Ruby runtime that improve performance; in particular, Ruby on Rails startup times have been much improved. (Shortly after Sunday's announcement, the Rails team confirmed that Rails 3.2.x is already compatible with Ruby 2.0.0.) In addition, Ruby 2.0.0 now supports run-time debugging of production code using DTrace.

Unlike Ruby 1.9.0, Ruby 2.0.0 is considered a stable release and current Ruby 1.9.3 programmers are encouraged to start using it for their production code. As the release notes state, "Ruby 2.0.0 is ready for practical use, and will absolutely improve your Ruby life."

The new version is available for download from the official Ruby website now, and the source code is also available via Github. ®

HP ProLiant Gen8: Integrated lifecycle automation

More from The Register

next story
HIDDEN packet sniffer spy tech in MILLIONS of iPhones, iPads – expert
Don't panic though – Apple's backdoor is not wide open to all, guru tells us
Chrome browser has been DRAINING PC batteries for YEARS
Google is only now fixing ancient, energy-sapping bug
Do YOU work at Microsoft? Um. Are you SURE about that?
Nokia and marketing types first to get the bullet, says report
Microsoft takes on Chromebook with low-cost Windows laptops
Redmond's chief salesman: We're taking 'hard' decisions
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
EU dons gloves, pokes Google's deals with Android mobe makers
El Reg cops a squint at investigatory letters
Big Blue Apple: IBM to sell iPads, iPhones to enterprises
iOS/2 gear loaded with apps for big biz ... uh oh BlackBerry
prev story

Whitepapers

Reducing security risks from open source software
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Application security programs and practises
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
Consolidation: the foundation for IT and business transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.