Ruby 2.0.0 Emphasizes Lazy
Written by Kay Ewbank   
Tuesday, 26 February 2013

A new stable version of Ruby has been released. Ruby 2.0.0 adds keyword arguments, new ways to extend classes, and extras in the built-in libraries.  

The release of Ruby 2.0.0 was timed to coincide with Ruby's 20th anniversary of the birth of the language. The first commit was made by its creator, Yukihiro Matsumoto, on February 24, 1993. To know more about its origins see Ruby turns 18.

According to the announcement of Ruby 2.0.0. on the Ruby site, the addition of keyword arguments gives flexibility to API design. Keyword arguments (named parameters) replace the method used until now within Ruby of using a dictionary of names and values to pass arguments to methods. Another change to the language is a move to UTF8 as default encoding.

There are several changes to the built-in libraries, starting with lazy enumerable classes. These give you a way to avoid building intermediate arrays, and saves you working out and specifying sizes of collections. There’s also an asynchronous exception handling API.

 

Still on the lazy front, Ruby now has backtrace lazy generation. Since the beginning, backtraces have been arrays of strings, and whenever an exception was raised, the strings were generated from up to down, which can be slow. Backtraces are now used instead of strings. These are lightweight and fast, and strings are only generated when actually needed. 

Debug support has been improved with the addition of DTrace support, which enables run-time diagnosis in production, and TracePoint, which is an improved tracing API.

Performance improvements include GC optimization by bitmap marking, VM optimization, and Kernel#require optimization which makes Rails startup very fast.

Some experimental changes have been made to the new version, including refinements, a new way of handling modularity and what Ruby-watchers think will become a replacement for the monkey-patching techniques currently used in Ruby. 

Marc-Andre Lafortune has posted a list of changes since the 1.9.3. release on Ruby News on Github.

 

ruby

 

 

More Information

Ruby 2.0.0-p0 is released - includes download links
Marcandre's list of changes

 

Related Articles

Ruby turns 18

Ruby 1.9.2 Released

 

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin,  or sign up for our weekly newsletter.

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Banner


Get Ready For Google Summer Of Code 2025
24/01/2025

2025 will be the  21st consecutive year of Google Summer of Code and the 4th year in which it will accept anybody aged 18 years and over who is a newcomer to open source software. As us [ ... ]



ELIZA Makes a Comeback
19/01/2025

ELIZA was the world's first chatbot, more than 50 years before the term itself was coined. She was the brainchild of Joseph Weizenbaum who wrote the original program in the 1960s at MIT.  Th [ ... ]


More News

Last Updated ( Tuesday, 26 February 2013 )