Menu
Ruby 2.7 improves garbage collection, pattern matching

Ruby 2.7 improves garbage collection, pattern matching

Ruby upgrade also includes enhancements to the REPL and an experimental just-in-time compiler

Credit: Aleksey Nemiro

Ruby 2.7, the latest upgrade of the Ruby programming language, is now generally available as a production release. The new release brings improvements in garbage collection, pattern matching, and REPL (read-eval-print-loop).

New in the Ruby 2.7 is compaction garbage collection, which is used to defragment a fragmented memory space. The GC.compact method compacts the objects in the heap so that fewer pages are used. Members of the Ruby development team explained that some multi-threaded Ruby programs may cause memory fragmentation, which leads to high memory utilization and speed degradation.

Other improvements in Ruby 2.7.0 include:

  • An experimental pattern matching capability, which can traverse a given object and assign a value if it matches a pattern. Pattern matching is widely used in functional programming languages.
  • Multi-line editing is now supported in irb, the interactive Ruby shell. Integration with rdoc, the Ruby documentation system, also is provided. With irb, developers can display the reference for a class, method, or module. Also, source lines shown at binding.irb and inspect results for core-class objects now are colorized.
  • Automatic conversion of keyword and positional arguments has been deprecated. This feature will be removed in Ruby 3.
  • For the still-experimental just-in-time (JIT) compiler, first introduced in Ruby 2.6, JIT-ed code is recompiled to less-optimized code when an optimization has been invalidated. Further, method inlining is performed when a method is considered pure. However, many methods are not yet considered pure.
  • An Enumerable#tally counts the occurrence of each element.
  • Also introduced is a numbered parameter as the default block parameter.

You can download Ruby 2.7 from ruby-lang.org.


Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Events

Featured

Slideshows

Meet the Reseller News 30 Under 30 Tech Awards 2020 winners

Meet the Reseller News 30 Under 30 Tech Awards 2020 winners

This year’s Reseller News 30 Under 30 Tech Awards were held as an integral part of the first entirely virtual Emerging Leaders​ forum, an annual event dedicated to identifying, educating and showcasing the New Zealand technology market’s rising stars. The 30 Under 30 Tech Awards 2020 recognised the outstanding achievements and business excellence of 30 talented individuals​, across both young leaders and those just starting out. In this slideshow, Reseller News honours this year's winners and captures their thoughts about how their ideas of leadership have changed over time.​

Meet the Reseller News 30 Under 30 Tech Awards 2020 winners
Reseller News Exchange Auckland: Beyond the myths — how partners can master cloud security

Reseller News Exchange Auckland: Beyond the myths — how partners can master cloud security

This exclusive Reseller News Exchange event in Auckland explored the challenges facing the partner community on the cloud security frontier, as well as market trends, customer priorities and how the channel can capitalise on the opportunities available. In association with Arrow, Bitdefender, Exclusive Networks, Fortinet and Palo Alto Networks. Photos by Gino Demeer.

Reseller News Exchange Auckland: Beyond the myths — how partners can master cloud security
Reseller News welcomes industry figures at 2020 Hall of Fame lunch

Reseller News welcomes industry figures at 2020 Hall of Fame lunch

Reseller News welcomed 2019 inductees - Leanne Buer, Ross Jenkins and Terry Dunn - to the fourth running of the Reseller News Hall of Fame lunch, held at the French Cafe in Auckland. The inductees discussed the changing face of the IT channel ecosystem in New Zealand and what it means to be a Reseller News Hall of Fame inductee. Photos by Gino Demeer.

Reseller News welcomes industry figures at 2020 Hall of Fame lunch
Show Comments