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

Business security measures using SSL

More from The Register

next story
'Windows 9' LEAK: Microsoft's playing catchup with Linux
Multiple desktops and live tiles in restored Start button star in new vids
Not appy with your Chromebook? Well now it can run Android apps
Google offers beta of tricky OS-inside-OS tech
New 'Cosmos' browser surfs the net by TXT alone
No data plan? No WiFi? No worries ... except sluggish download speed
SUSE Linux owner Attachmate gobbled by Micro Focus for $2.3bn
Merger will lead to mainframe and COBOL powerhouse
iOS 8 release: WebGL now runs everywhere. Hurrah for 3D graphics!
HTML 5's pretty neat ... when your browser supports it
Greater dev access to iOS 8 will put us AT RISK from HACKERS
Knocking holes in Apple's walled garden could backfire, says securo-chap
NHS grows a NoSQL backbone and rips out its Oracle Spine
Open source? In the government? Ha ha! What, wait ...?
Google extends app refund window to two hours
You now have 120 minutes to finish that game instead of 15
Intel: Hey, enterprises, drop everything and DO HADOOP
Big Data analytics projected to run on more servers than any other app
prev story

Whitepapers

Providing a secure and efficient Helpdesk
A single remote control platform for user support is be key to providing an efficient helpdesk. Retain full control over the way in which screen and keystroke data is transmitted.
Saudi Petroleum chooses Tegile storage solution
A storage solution that addresses company growth and performance for business-critical applications of caseware archive and search along with other key operational systems.
Security and trust: The backbone of doing business over the internet
Explores the current state of website security and the contributions Symantec is making to help organizations protect critical data and build trust with customers.
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.
Security for virtualized datacentres
Legacy security solutions are inefficient due to the architectural differences between physical and virtual environments.