The latest upgrade to Ruby, the popular open source dynamic language, will enhance both performance and simplicity.
A preview of the upgrade, Ruby 2.4.0, was released this week. The general release of is due on Christmas Day, December 25, with a beta release due several months prior to general availability, Ruby founder Yukihiro Matsumoto said.
Preview 1 improves performance by optimizing [x, y].max and .min methods to not create a temporary array under some conditions. The language also gets a performance boost by adding a Regexp#match method, which executes a regexp match without creating a back reference object, leading to reduced object allocation. Regexp holds a regular expression and is used to match patterns against strings. Version 2.4.0 also speeds up instance variable access.
Ruby 2.4.0 promotes simplification through the unification of Fixnum and Bignum integer classes. "In the early stage of Ruby development, I inherited integer class design from Lisp and Smalltalk," Matsumoto said. "Lisp has Fixnum and Bignum. Smalltalk has SmallInteger and BigInteger. But from 20 years of experience, we found out the distinction according to the integer size is artificial and not essential to the programming."
To improve debugging, thread deadlock detection is enhanced in the upgrade, according to a bulletin on the release. "Ruby has deadlock detection around waiting threads, but its report doesn't include enough information for debugging. Ruby 2.4's deadlock detection shows threads with their backtrace and dependent threads."
Also in version 2.4.0, the String/Symbol#upcase/downcase/swapcase/capitalize(!) method now supports Unicode case mappings instead of just ASCII mappings. "Unicode was not popular when we added Unicode support to Ruby. So after the discussion with experts -- including(XML co-founder) Tim Bray, who was a member of [the] Unicode consortium back then -- we decided to make those methods to support ASCII only," said Matsumoto. "But as years passed, everybody uses Unicode now, especially in the Web field, and we can rely on the case conversion table from Unicode.org. The new case conversion is more natural for programmers using non-ASCII characters."
Sign up for CIO Asia eNewsletters.