Talks
Keynote: Ruby 3 and Beyond

Keynote: Ruby 3 and Beyond

by Yukihiro "Matz" Matsumoto

In his keynote at RubyConf 2020, Yukihiro "Matz" Matsumoto presented an overview of Ruby 3, touching upon its features, performance goals, and future directions. The anticipated release date for Ruby 3 is December 25, 2020, despite the postponed Tokyo Olympics. Matz emphasized a commitment to maintaining compatibility with Ruby 2.x programs, learning from past experiences with version transitions that caused community splits, such as Ruby 1.8 to 1.9 and Python 2 to 3.

Key points discussed include:

- Compatibility and Performance: Ruby 3 aims for complete compatibility with Ruby 2.x, ensuring programs can transition with minimal modifications. Performance is a critical focus, with the goal of achieving a threefold speed increase over Ruby 2.0, leveraging improvements from the Just-In-Time (JIT) compiler and the YARV virtual machine.
- Concurrency Enhancements: Recognizing the shift to multi-core processors, Ruby 3 will introduce features like 'Guilds' and 'Actors' to better manage concurrent programming and improve CPU-intensive and IO-heavy tasks.
- Static Type Checking: With the introduction of Ruby signatures, Matz discussed plans to incorporate optional static type checking to help identify code contradictions while preserving the dynamic nature of Ruby.
- Future Tools and Integration: Tools like Solargraph, Sorbet, and RuboCop are set to improve the Ruby experience post-Ruby 3, with ideas for enhancing coding efficiency and introducing macros for powerful code transformations.
- Community Collaboration: Matz emphasized the importance of collaborative efforts within the Ruby community to innovate and refine the language, inviting all Rubyists to contribute their ideas, especially regarding experimental features still in the conceptual stage.

In conclusion, Matz’s vision for Ruby 3 is positioned to enhance Ruby's capability, performance, and usability for developers, with continual improvements and a focus on community collaboration. The keynote serves as a call to the Ruby community to engage actively in these developments, ensuring a vibrant future for Ruby.

00:00:09.679 Hi, this is Matz. I'm very glad to see you. This is RubyConf 2020, and I am happy to be here virtually this year. Due to the coronavirus outbreak, everything has changed; many conferences and events have been canceled or have gone online, including this one. I have had very little chance to visit other countries and communicate with the members of the Ruby community. The biggest problem is that my opportunity to speak in English has diminished, so my ability to converse has worsened.
00:01:08.720 Please stand by.
00:01:29.119 In this keynote, I am going to talk about Ruby 3 and beyond. The release of Ruby 3 is planned for December 25th this year, 2020, and since this conference is in November, you only have to wait for about a month. The schedule for Ruby 3 was decided to coincide with the year of the Tokyo Olympics, but due to the pandemic, the Olympic Games have been postponed. We have discussed the schedule and decided to release Ruby 3 as planned, as it is not directly related to the Olympics.
00:02:00.240 As long as something extremely disastrous doesn't happen, we should see its release in December. Let’s hope for the best. Ruby 3 is designed to be compatible, faster, and better than its predecessors. First, let me talk about compatibility. Ruby 3 will be compatible with Ruby 2.x, meaning that almost all Ruby 2.x programs should run on Ruby 3 without any modifications.
00:02:50.319 This is a crucial aspect we've learned from the past. More than a decade ago, we released Ruby 1.9, which had compatibility issues. Specifically, there was a significant change between Ruby 1.8 and 1.9 due to improvements in encoding support. When we first started developing Ruby in 1993, Unicode was not as popular as traditional encodings like ASCII and Shift-JIS. Over time, as the popularity of Unicode grew, we had to adapt Ruby to support it, especially in classes like strings and regular expressions. This transition caused a split within the community for over five years, where some continued using Ruby 1.8 while others moved on to later versions.
00:03:41.200 We’ve seen similar situations in other programming languages; for instance, Python 2 and Python 3 had compatibility issues leading to migration challenges, culminating in the declaration of Python 2's end of life this year. Similarly, PHP 6 faced abandonment due to drastic changes that the community wasn't ready to adopt, resulting in a restart with PHP 7. Such experiences should teach us that while language designers are motivated to improve a language, they must also be cautious, as changes can lead to incompatibilities.
00:05:07.760 Thus, in designing Ruby, we must consider the balance between progression and compatibility. Our basic principle is to maintain compatibility, striving for full compatibility with only a few bug fixes. Unfortunately, some programs heavily rely on certain buggy behaviors, so if we fix those bugs, applications may need to be updated without any fault on the developers' part.
00:06:36.160 In the previous Ruby versions, we focused on tiny fixes, but we aim for new features that not only enhance compatibility but also improve performance. Ruby 3 should be significantly faster; performance is crucial. We learned from the Ruby 1.9 experience that performance issues affected the community. Python's community similarly experienced a 15-plus year split due to Python 3's introduction. I believe a key difference in the pace of migration is Ruby's new virtual machine, called YARV (Yet Another Ruby VM), which drastically improved performance.
00:07:20.240 In benchmarks, YARV runs several times faster than its predecessor. However, while Ruby performance is generally adequate, some benchmarks show Ruby lagging behind other languages. Users often use micro-benchmarks to form their opinions, leading to the perception that Ruby is significantly slower than it might be in actual use cases.
00:09:00.800 We realize that reputation can be heavily influenced by micro-benchmark results, which is why we introduced the Just-In-Time (JIT) compiler. The JIT compiler generates native code at runtime, which enhances performance, especially for CPU-intensive tasks.
00:09:27.120 In Ruby 2.6, we introduced the JIT compiler hoping to achieve a performance boost in Ruby 3, where we aim for a threefold increase in speed compared to Ruby 2.0. In various benchmarks, notably for specific applications like a Nintendo emulator, we expect to see significant improvements.
00:10:10.880 Importantly, the current JIT compiler may not yet optimize Ruby on Rails applications perfectly, but improvements are ongoing, with a goal for greater speed in future applications post-Ruby 3. Although micro-benchmarking remains significant, we need to enhance Ruby's optimizations for real-world applications. For instance, improvements in garbage collection are also on the table to boost overall performance.
00:11:06.400 The modern development of Ruby dates back to 1993, a period when single-core CPUs ruled the roost. Today, however, the performance landscape has shifted. Single-core performance has plateaued, and we find ourselves in the multi-core age where leveraging concurrent programming is essential for optimal performance.
00:12:24.560 Unfortunately, Ruby's current version still has challenges, as it runs under a Global Interpreter Lock (GIL). While this GIL adds complexity to thread safety, improving concurrency and enabling the efficient execution of multi-core capabilities is at the forefront of our objectives for Ruby. We plan to introduce new features like 'Guilds' and 'Actors' to enhance Ruby’s concurrency capabilities. Guilds will allow IO-heavy tasks to perform with less overhead, while actors will handle CPU-intensive workloads more efficiently.
00:14:27.600 Of course, Ruby 3 will also continue to evolve in terms of error detection and management. With the rise of static typing across several programming languages, we see an opportunity to integrate static type checking into Ruby without losing its dynamic roots. We’re introducing Ruby signatures to formalize the type representation for core classes and functions, hoping to improve the development experience.
00:15:59.200 The type checker will assist in identifying contradictions within your code, enabling developers to proactively resolve issues. We aim to enhance function parameter matching with better syntax and to introduce pattern matching for JSON data among other data structures. This involves a syntax overhaul to boost conciseness and readability.
00:17:19.799 These new features strengthen Ruby’s versatility without sacrificing simplicity, and we look forward to future improvements that may introduce static barriers that restrict dynamic features to enhance performance further. While these ideas are still speculative, I believe such enhancements can dramatically benefit the efficiency of Ruby.
00:18:15.280 I have also been considering the possibility of integrating macros into Ruby, which would allow for more powerful code transformations. This addition could transform how we develop in Ruby, soaring beyond its current capabilities while ensuring that those entering Ruby for the first time find it as approachable as ever.
00:21:20.320 I must stress that, while these ideas are exciting, they are still in the conceptual stage. Following the formal release of Ruby 3, we plan to focus on enhancing our tooling, such as enhancing Solargraph, Sorbet, and RuboCop, to create better user experiences.
00:22:56.879 Our aim is to bolster Ruby 3's capabilities alongside its performance. We're also exploring creating multi-layered architecture for handling language features. Future improvements could include utilizing existing tech to enhance speed and efficiency, thus ensuring that Ruby continues to thrive in modern development.
00:24:53.840 Lastly, we appreciate all contributions and collaboration within the Ruby community. It's vital that we collaborate to create a more efficient, robust language. All input helps us enhance Ruby, and while many features are still experimental, we openly invite experimentation and suggestions.
00:26:30.239 The Ruby community is vibrant, and together, we can ensure it flourishes with innovative ideas and implementations. Let’s continue to push the boundaries of Ruby into a new realm, making the language better for everyone.
00:28:05.679 We welcome every Rubyist to join this journey as we improve the tools, and to engage actively with enhancing the coding experience for future generations. Thank you for being part of this exciting adventure.
00:28:24.000 Thank you.