InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

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

Posted by Werner Schuster on Jul 20, 2009

Sections
Development,
Architecture & Design
Topics
Dynamic Languages ,
Runtimes ,
Ruby ,
Performance & Scalability
Tags
ParseTree ,
GarbageCollection ,
Rubinius ,
Ruby1.9 ,
JRuby ,
Merb

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, http://ruby-versions.net/:

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.

No comments

Watch Thread Reply

Educational Content

Jesper Boeg on Priming Kanban

In this interview, Jesper Boeg, author of the new InfoQ book – Priming Kanban, discusses the keys to using Kanban effectively, and how to get started if you are currently using other approaches.

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.