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


RAG from Scratch
10/12/2024

The "RAG from Scratch" tutorial by Langchain coupled with the "RAG playground" are two great educational resources that will help you kickstart your journey with RAG.



Linkerd Adds Egress And Rate Limiting
05/12/2024

Linkerd has announced a new version of its service mesh. It adds three major new features: egress traffic visibility and control; per-service rate limiting; and federated services.


More News

Last Updated ( Tuesday, 26 February 2013 )