Ruby VM Roundup: Ruby 1.9.2 Preview 1, Ruby Versions Site

| by Werner Schuster Follow 9 Followers on Jul 20, 2009. Estimated reading time: 2 minutes |

The next version of Ruby is due later this year, and now its first preview version, 1.9.2 Preview 1, is available. A detailed list of changes is available, the release notes point out these API changes:

  • Socket API was more objectified.
  • Time was reimplemented and enhanced. Now Time has no max/min value, no year 2038 problem.
  • New Random class for random number sequence.
  • Good news for merb users: Method#parameters.

The last item on this list, new method Method#parameters, is necessary for Merb's action arguments feature, which needs to know the number and names of a method's formal arguments. On Ruby 1.8.x, ParseTree was used to implement this functionality, but as ParseTree has been EOL'ed and is not available on Ruby 1.9.x, action arguments weren't available on 1.9.x. Workarounds were created for JRuby and for 1.9.1 with the methodpara gem.
Now with Method#parameters, getting the formal arguments of a method is easy. Simply get a handle of the method and call parameters. For instance, the arguments of this method

def hello(a,b,x=42, *args)

will be represented by this:

[[:req, :a], [:req, :b], [:opt, :x], [:rest, :args]]

A quick look through the Ruby Trunk ChangeLog (Caution: large file), shows a recent improvement by Narihiro Nakamura. The 'Longlife GC patch' (link shows the diffs) changes the VM and GC to treat long lived objects differently from other objects. According to the changes, in the current incarnation, long lived objects seem to be method bodies and inline cache entries. Remembered sets are used to track changes in the long lived space.

There are more plans for features to add to 1.9.2; it remains to be seen which make it into the final version.

Writing a compatible Ruby library was certainly easier half a decade ago when there was one mainstream Ruby version. Now libraries should be compatible with Ruby 1.9.x, as well as the host of alternative Ruby implementations.
David A. Black announced the Ruby versions site,

I've set up a site where you can ssh in and have access to a bunch of historical and modern Ruby versions and implementations, including Ruby 1.0 through 1.9.2 snapshot, Rubinius, JRuby, and Ruby Enterprise Edition.

Another way to check code across Ruby versions is MultiRuby, which will download Ruby versions and run code on all versions.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you