Ruby 2.7 is released to the general public

Recently the Ruby Project announced that they are releasing Ruby 2.7.0 to the general public. This post is intended to summarize the changes to a non-technical audience.

Summary with Personal Insights

The Ruby 2.7.0 update adds: pattern matching, an improved REPL (command line tool to write ruby in), improved garbage collector (reduces memory usage and improves efficiency), and separates positional and keyword arguments.

The new pattern matching functionality rivals that of Elixir’s pattern matching and will provide new problem solving tools to Ruby Developers.

The REPL is using a new version of readline, it’s faster and now has syntax highlighting. This will make things more readable and provide a more pleasant experience to Ruby developers. Maybe improved to the point where third party gems (libraries) like PRY are no longer necessary except for specialized debugging workflows.

Improved garbage collection will speed up run-time performance and be extra helpful to developers running on older hardware and in memory constrained environments. The user can directly invoke it however they should proceed with cautious and work to write memory efficient code from the start rather than cleaning messy memory later on.

The separation of positional and keyword arguments is a bit tricky to explain. Imagine you have a method which asks you to explicitly declare keywords and pass a value. Previously you could put this information into a Hash (a type of dictionary like data structure) and it would be automatically converted. This behavior is error prone and deprecated as a Ruby 2.7.0, to request a conversion in the future you’ll need to prepend a hash variable with **variable_name to have a positional argument converted into the required keyword argument. It’s my understanding that eventually this behavior won’t be allowed at all so it’s best to update your code now rather than later.

Source: https://www.ruby-lang.org/en/news/2019/12/25/ruby-2-7-0-released/