Feeds

Ruby 2.0.0 adds syntax sparkle, boosts performance

First major stable release in five years

Choosing a cloud hosting partner with confidence

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

Intelligent flash storage arrays

More from The Register

next story
Nexus 7 fandroids tell of salty taste after sucking on Google's Lollipop
Web giant looking into why version 5.0 of Android is crippling older slabs
Be real, Apple: In-app goodie grab games AREN'T FREE – EU
Cupertino stands down after Euro legal threats
Download alert: Nearly ALL top 100 Android, iOS paid apps hacked
Attack of the Clones? Yeah, but much, much scarier – report
Microsoft: Your Linux Docker containers are now OURS to command
New tool lets admins wrangle Linux apps from Windows
Bada-Bing! Mozilla flips Firefox to YAHOO! for search
Microsoft system will be the default for browser in US until 2020
prev story

Whitepapers

Why and how to choose the right cloud vendor
The benefits of cloud-based storage in your processes. Eliminate onsite, disk-based backup and archiving in favor of cloud-based data protection.
Forging a new future with identity relationship management
Learn about ForgeRock's next generation IRM platform and how it is designed to empower CEOS's and enterprises to engage with consumers.
Reg Reader Research: SaaS based Email and Office Productivity Tools
Read this Reg reader report which provides advice and guidance for SMBs towards the use of SaaS based email and Office productivity tools.
Business security measures using SSL
Examines the major types of threats to information security that businesses face today and the techniques for mitigating those threats.
Storage capacity and performance optimization at Mizuno USA
Mizuno USA turn to Tegile storage technology to solve both their SAN and backup issues.