β

Ruby 2.4.0 Released

Ruby News 9 阅读

We are pleased to announce the release of Ruby 2.4.0.

Ruby 2.4.0 is the first stable release of the Ruby 2.4 series. It introduces many new features, for example:

Introduce hash table improvement (by Vladimir Makarov)

Improve the internal structure of hash table (st_table) by introducing open addressing and an inclusion order array. This improvement has been discussed with many people, especially with Yura Sokolov.

Binding#irb: Start a REPL session similar to binding.pry

While you are debugging, you may often use p to see the value of variables. With pry you can use binding.pry in your application to launch a REPL and run any Ruby code. r56624 introduces binding.irb which behaves like that with irb.

Unify Fixnum and Bignum into Integer

Though ISO/IEC 30170:2012 doesn’t specify details of the Integer class, Ruby had two visible Integer classes: Fixnum and Bignum. Ruby 2.4 unifies them into Integer. All C extensions which touch the Fixnum or Bignum class need to be fixed.

See also the ticket and akr’s slides .

String supports Unicode case mappings

String/Symbol#upcase/downcase/swapcase/capitalize(!) now handle Unicode case mappings instead of only ASCII case mappings.

Performance improvements

Ruby 2.4 also contains the following performance improvements including language changes:

Array#max, Array#min

[x, y].max and [x, y].min are optimized to not create a temporary array under certain conditions.

Regexp#match?

Added Regexp#match? , which executes a regexp match without creating a back reference object and changing $~ to reduce object allocation.

Other performance improvements

Debugging

Thread#report_on_exception and Thread.report_on_exception

Ruby ignores exceptions in threads unless another thread explicitly joins them. With report_on_exception = true , you can notice if a thread has died due to an unhandled exception.

Send us feedback what should be the default for report_on_exception and about report-on-GC, which shows a report when a thread is garbage collected without join.

Thread deadlock detection now shows threads with their backtrace and dependency

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.

Other notable changes since 2.3

See NEWS or commit logs for details.

With those changes, 2523 files changed, 289129 insertions(+), 84670 deletions(-) since Ruby 2.3.0!

Merry Christmas, Happy Holidays, and enjoy programming with Ruby 2.4!

Download

Posted by naruse on 25 Dec 2016

作者:Ruby News
The latest news from ruby-lang.org.
原文地址:Ruby 2.4.0 Released, 感谢原作者分享。

发表评论