Feeds

Ruby 2.0.0 adds syntax sparkle, boosts performance

First major stable release in five years

Reducing security risks from open source software

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. ®

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

More from The Register

next story
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
Captain Kirk sets phaser to SLAUGHTER after trying new Facebook app
William Shatner less-than-impressed by Zuck's celebrity-only app
Apple fanbois SCREAM as update BRICKS their Macbook Airs
Ragegasm spills over as firmware upgrade kills machines
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
Mozilla fixes CRITICAL security holes in Firefox, urges v31 upgrade
Misc memory hazards 'could be exploited' - and guess what, one's a Javascript vuln
Put down that Oracle database patch: It could cost $23,000 per CPU
On-by-default INMEMORY tech a boon for developers ... as long as they can afford it
Google shows off new Chrome OS look
Athena springs full-grown from Chromium project's head
prev story

Whitepapers

Top three mobile application threats
Prevent sensitive data leakage over insecure channels or stolen mobile devices.
Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
Designing a Defense for Mobile Applications
Learn about the various considerations for defending mobile applications - from the application architecture itself to the myriad testing technologies.
Build a business case: developing custom apps
Learn how to maximize the value of custom applications by accelerating and simplifying their development.