Rubyconf 2019 is just behind us, and as always Matz keynote is packed with information on what’s coming next for ruby. Some of it are concrete things, some are more subtle, mostly due to being Matz opinions, and as the leader of ruby design, his opinions means a lot.

You can watch the full keynote here: https://www.youtube.com/watch?v=2g9R7PUCEXo thanks to Confreaks amazing work every year in recording this conference.

Programming joy, community, and attracting new people

The first few minutes of the keynote is devoted to these 3 themes, that are strongly interconnected, and by looking at Matz words, we can better understand his priorities for the language.

Attracting new people is super important, for the language not to be stagnant and slowly die. That’s obvious. The how part, and deciphering Matz intents are the interesting parts.

Matz talks a lot about programming joy. How ruby is joyful for the developer. Actually, that’s all he talks about in the first segment of the keynote. Performance is not mentioned until he talks about Ruby 3.0 and the 3x3 promise. Joy of programming, to the meaning of Matz of this thing, is obviously his top priority.

Even when he gets to talk about Ruby 3.0 plans, which includes performance, multi core and bigger teams work improvements, he first shows this slide:

He makes it very obvious that performance and big team work is other peoples priority, not his. And the performance work is mostly to address the community unrest in the past few years about ruby performance.

This expands to other features as well, most notably, type annotations.

That means — realistically, don’t ever expect any type annotations to be ruby official. 3rd party type systems such as Sorbet are the best choice for those wanting it, but full embrace by ruby, and thus, the community as whole, is probably not going to happen any time soon.

That is not to say there is no value in type system. It’s just that type annotations are what Matz is coming against. He mentioned getting the value of type system inference without type annotations, but it is far away.

That’s not to say any of this is good or bad, this is just Matz opinions and we should be aware that these opinions will drive Ruby language forward in the future. My interpretation from his talk is that we can expect higher focus on programming joy, and performance/other improvements whenever the community outcry is strong enough and hurt onboard new programmers to the community.

Ruby 3.0 release date

This December will mark Ruby 2.7 release, and next year December we will have Ruby 3.0 out.

This release timeline is fixed, and what that means, is that some announced 3.0 feature might be dropped in order to meet this deadline. Those features will be implemented in future releases of Ruby, just not initially with Ruby 3.0.

Ruby 2.7 — Upcoming features

Deprecations and backward incompatibilities

Ruby 2.7 will introduce warnings to 2 features, which will be removed/changed by 3.0. Ruby 2.7 is fully compatible with 2.6, just with added warnings.

Keyword arguments

Keyword arguments as they are right now are a mess of expectations. Matz examples are simple and to the point:

def m(a, key: 10)

p [a,key]

end

m(key: 5) #=> [{:key=>5}, 10] def foo(opts = {}, key: 10)

p [opts,key]

end

foo(key: 42) #=> [{}, 42]

Weird, and confusing.

Ruby 2.7 will be compatible with Ruby 2.6, but it will fire warnings.

Ruby 2.7 will allow for the new functionality to be toggled by a flag, and in Ruby 3.0 this new functionality will be the default.

Numbered parameters

Another controversial and somewhat confusing feature of ruby to be removed by 3.0, and fire warnings in 2.7.

# `_1` is referring to the first argument into `map`.

[1,2,3].map {_1 * 2} #=> [2,4,6]

Ruby 2.7 new features

Pattern matching

Originally announced for ruby 3.0, pattern matching will be launched with ruby 2.7.

I recommend reading about this feature here: https://www.toptal.com/ruby/ruby-pattern-matching-tutorial

Matz does mention that pattern matching is slow in Ruby. So, use it wisely in case you care about performance.

Improved IRB

IRB will receive a couple of “quality of life” features;

Multiline edit — within the REPL, this will make code editing much easier while prototyping.

Inline references — Hitting TAB twice in the IRB will now show you inline reference in place. No need to go out of the terminal anymore.

More features

Numbered parameters: Will have warnings, to be removed by 3.0

Arguments forwarding will be added

Endless ranges will be added

GC Compaction will be added. There is a talk completely devoted to it by Aaron Patterson: https://www.youtube.com/watch?v=1F3gXYhQsAY

Unicode 12.1 (More emojis)

Faster fiber

Faster JIT

Convenience methods added: Enumerable#tall Enumerable#filter_map UnboundMethod#bind_call

What is not coming

Pipeline operator is canceled. Basically, because its behavior is dependent on initial language design, and expectations of its behavior might defer from people coming with Elixir expectations to F# expectations.

Method reference operator is canceled. Basically, to be well though out as part of grand plan for functional programming support.

Summary

Ruby is moving forward.

Ruby 2.7 will be an incremental improvement, and for the first time, with some language deprecation. Ruby 3.0 seems to be just yet another incremental improvement with minor breaking changes already marked out with Ruby 2.7.

The most exciting thing for Ruby 3.0 might be the JIT compiler, as it is expected to be ready and grant some nice performance improvements.

As for the general outlook for the future, it seems that Matz prioritize language beauty and joy above everything else. That means no ugly type annotations, or even Method reference operators, which he mentioned was canceled partly because it looked ugly.