In association with heise online

25 February 2013, 12:22

Ruby 2.0 appears on the language's 20th anniversary

  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

Ruby icon The Ruby developers have, as intended, released a major new version of the scripting language on the 20th anniversary of the first commit of the language. Ruby 2.0.0-p0 is described as not as disruptive a change as the transition from Ruby 1.8 to 1.9, making the migration to the new version easier, but, nonetheless contains numerous improvements to the language and runtime – in all around 320 large and small features.

These include core language additions such as keyword arguments which give more flexibility when designing APIs, new ways to extend classes, and a switch to UTF8 as default encoding. Keyword arguments, also known as named parameters, replace Ruby's pattern of passing arguments to methods with a dictionary of names and values, with a simple, explicit, inline syntax which also allows for default values for parameters.

There are also new "lazy Enumerable" classes in the built-in libraries as well as an asynchronous exception handling API. The "lazy Enumerable" classes allow for a compact notation for expressing loops and "infinite" collections without the use of temporary arrays; this should also allow for better handling of large sets of data, avoiding the need to load the entire set into memory.

Debugging has been enhanced with DTrace support and an improved tracing API. There are also runtime improvements such as GC optimisation, require optimisation (which makes Rails startup much faster), VM optimisation, and float optimisations.

One feature, refinements, has been added to Ruby 2.0 as an experimental feature; this new concept for Ruby's handling of modularity was rethought in December as Ruby 2.0 approached release and is expected to evolve into an important replacement to monkey-patching techniques used in Ruby. The developers do warn that the refinements specification is likely to change in future.

A full list of changes in Ruby 2.0.0-p0 is included in the NEWS file. Ruby 2.0.0-p0, despite its p0 "Teeny" number, is regarded as a stable release of Ruby; for example, Rails 4.0 already requires Ruby 2.0.

Source code downloads for Ruby 2.0.0 are linked to in the announcement. Ruby 2.0.0 is released under either the 2-clause BSD licence or under the "Ruby licence", as per the change from GPL made at the time of the Ruby 1.9.3 release in 2011.

(djwm)

 


  • July's Community Calendar





The H Open

The H Security

The H Developer

The H Internet Toolkit