00:00:00
Raita, why don't you tell us who we've got on first?
00:00:05
Okay, so as the creator of Ruby, he needs little to no introduction at all.
00:00:12
He's been working on Ruby for more than 25 years, but even the creator of Ruby sometimes faces challenges with technology.
00:00:19
You'll find out later because he sent us his recorded talk, and he encountered some challenges with that. But after his stream, we will open our Q&A session with him, so please ask your questions in our chat.
00:00:32
I never really know where the chat is, so please ask your questions there, and we will make sure to ask them to Matz when he joins us.
00:00:44
He's going to show us not just what's coming with the release of Ruby 3, but he will also tell us a bit about the future of Ruby. So, Matz, take it away.
00:01:10
Hi, this is Matz, the creator of the Ruby language. Today, I admit that I failed to record the previous trial, so I'm feeling a little tired.
00:01:19
Anyway, thank you for having me at the NoRuKo conference. Unfortunately, due to the coronavirus outbreak, we cannot gather together in person.
00:01:34
Many conferences have been canceled, but thanks to technology, we can share our ideas and plans with the community through the internet.
00:01:53
Today, I'm going to talk about Ruby 3 and beyond. For the last four to five years, I've been discussing the future of Ruby 3 for a long time.
00:02:14
You might be sick of hearing about Ruby 3 from me, as I started explaining about it in previous conferences such as RubyConf and RubyKaigi.
00:02:28
But this year, it’s real—it will be available on December 25, 2020, as we planned.
00:02:40
If everything goes okay and unless something very, very bad happens, we will release Ruby 3 in December.
00:02:54
In the past, I mentioned that Ruby 3 would be available in conjunction with the Tokyo Olympics, but due to the coronavirus, the Olympics have been postponed to next year.
00:03:21
Some people in the community discussed whether we should postpone the release of Ruby 3 to next year because of that, but after discussions, we decided to move forward and release Ruby 3 this December.
00:03:39
As an open-source community, we have to keep moving forward. We cannot stop evolving; otherwise, we will die.
00:03:57
Everyone likes new things. As a programmer and engineer who enjoys new things, I consider myself a language geek.
00:04:17
I love to study new programming languages. There are many exciting new programming languages out there, like Elixir, Rust, and Go.
00:04:37
It's thrilling to explore new ideas and technologies. Learning new things brings joy.
00:05:00
However, Ruby is kind of old; it was released to the internet in 1995, making it 25 years old.
00:05:16
The language's birth was marked by its first release. But in reality, no one wants pain, and we have many web applications out there.
00:05:31
If we progress, we need to change Ruby to accommodate new ideas and technologies, but upgrading your application can be very painful.
00:05:48
And so, we face the contradiction that we want Ruby to be stable, yet we want it to evolve.
00:06:06
Overcoming these contradictions in language design is quite challenging.
00:06:24
As language designers, we often want to fix past mistakes. Throughout the history of programming languages, many have made major incompatible changes to correct previous errors.
00:06:42
For example, Ruby 1.9 made significant changes from Ruby 1.8 to fix its past mistakes, similar situations happened with Python 2 and 3.
00:07:00
The PHP community has also tried to address the drawbacks experienced in PHP 5, and the ECMAScript community faced similar challenges with ECMAScript 4.
00:07:17
Ultimately, no one wants the pain of incompatibility; when we introduce significant changes that disrupt compatibility, it leads to tragic situations.
00:07:34
For instance, some users continued using Ruby 1.8 for years because migrating to Ruby 1.9 or later was challenging.
00:07:49
It took more than five years for the Ruby community to shift to Ruby 2.0. Python 3’s transition was also lengthy; this year (2020), they have officially declared the end of life for Python 2.
00:08:09
The whole Python community was forced to move to Python 3, which took 15 years for many.
00:08:27
Moreover, PHP 6 was canceled, and it was dropped before any significant release could be made.
00:08:41
ECMAScript 4 also faced cancellation due to similar issues with incompatible changes.
00:08:58
The design of programming languages reflects the struggles of the human mind.
00:09:15
If we don't make changes, people become bored and leave the community, but if they experience too much pain from migration, they also leave for new projects.
00:09:29
This leads us to a dilemma: our past changes have caused suffering, and many developers might seek alternatives like Rust or Go.
00:09:46
Understanding human psychology is quite difficult, making language design a challenging task.
00:10:04
However, we need to continue progressing to shape a better future. Ruby 3 represents that future.
00:10:21
We have to keep our community engaged. The basic principle of Ruby 3 is that we should maintain compatibility while making significant improvements.
00:10:42
We aim to make Ruby faster and improve productivity for Ruby programmers.
00:10:59
The three major goals of Ruby 3 will be: being fast, being concurrent, and being correct.
00:11:37
Faster Ruby can be achieved through various improvements, with Just-In-Time (JIT) compilation being a major part of enhancing performance.
00:12:06
JIT stands for Just-In-Time compiler, which dynamically generates native code using an algebraic compiler named MJ.
00:12:23
With MJ, Ruby can run three times faster in some benchmarks, but it has not yet been used in Rails applications.
00:12:38
Initially, when MJ was introduced in Ruby 2.4, Rails applications ran slower using it, but now with Ruby 2.7, they run as fast as without it.
00:12:55
Concurrency is another goal for Ruby 3.
00:13:01
Years ago, when I was developing the first version of Ruby, computers had only one CPU.
00:13:16
Nowadays, even smartphones have multiple cores, so leveraging these cores is critical for performance.
00:13:29
We aim to achieve concurrency through two main approaches: the Asian Guy (Fiber) and Raptor.
00:13:49
The Asian Guy Fiber is a way to handle I/O access to improve I/O bottlenecks.
00:14:02
While some languages utilize async and await, we use fibers.
00:14:16
For instance, Node.js initially relied on callbacks for every I/O operation, which resulted in callback hell.
00:14:37
They later introduced promises and later async/await to simplify the process.
00:14:49
In Ruby 3, we will implement async I/O fibers without needing new keywords.
00:15:03
Fibers will switch context to utilize blocking time effectively, improving performance.
00:15:19
The Ruby application server named Falcon is built on similar technology and shows significant performance benefits.
00:15:36
The developer behind Falcon, Amir Williams, is also in charge of developing the Asian Guy Fiber.
00:15:46
The second approach, Raptor, is not a reactor system; it is focused on CPU-intensive tasks.
00:16:04
Raptor improves performance through isolated object spaces for each actor, allowing them to communicate via channels.
00:16:21
It's designed to handle CPU bottlenecks effectively. The sharing of states is limited to immutable objects.
00:16:39
The types of shareable objects are immutable objects, deeply frozen objects, and cluster modules.
00:16:56
In Ruby, classes and modules are mutable, but access from different actors will be protected.
00:17:14
This means we no longer have a global interpreter lock, allowing each actor to run parallel multi-core.
00:17:30
The third goal for Ruby 3 is to make it a more correct language by checking for errors earlier.
00:17:49
We introduced static type checks through RBS, which stands for Ruby signature.
00:18:06
We also have a type profiler that generates RBS, which is used for type checking in Ruby.
00:18:21
It's similar to the type system in TypeScript, designed to handle Ruby's dynamic typing.
00:18:39
The class Foo has two methods: 'foo' which does not return anything, and 'to_s' which returns a string and takes arguments.
00:18:55
Ruby 3 will come bundled with RBS for core libraries such as strings, arrays, and hashes.
00:19:12
We can use type information in the RBS files, enhancing type checking in applications.
00:19:28
Additionally, we have tools such as the type profiler that conducts basic type checks and generates RBS type information.
00:19:45
For example, through abstract interpretation, we can analyze Ruby programs and statically follow their execution path.
00:20:02
With this information, we can deduce the types of method arguments and their return values.
00:20:17
This helps identify type mismatches, allowing developers to catch potential bugs early.
00:20:35
Ruby's static type checking will not pursue completeness or soundness due to its dynamic nature.
00:20:52
We currently focus on finding and addressing more errors compared to today.
00:21:07
We will separate RBS files to allow for improved type information without embedding it into the language syntax.
00:21:28
Future IDEs will help manage the type information updates as code evolves.
00:21:41
Moreover, we will enhance Ruby by adding new syntax features. For example, pattern matching will be introduced.
00:22:02
This allows developers to retrieve nested values more cleanly and naturally.
00:22:19
Right-hand side assignments are another feature to streamline method chaining in Ruby.
00:22:33
Having to assign variables at the top when creating long sequences of transformations can be cumbersome.
00:22:51
Now you can write sequences together and assign to a variable on the right-hand side.
00:23:07
This makes it easier to read and write long chains of method calls.
00:23:20
Additionally, the introduction of number of block parameters allows more flexibility.
00:23:37
As we look forward, we will release Ruby 3.0 this December.
00:23:48
We should also consider what will happen after Ruby 3.0. I don't anticipate any major syntax changes.
00:24:07
Stability is essential, and we will not introduce any major incompatible changes.
00:24:26
We will continue to improve supporting tools like Solargraph, which helps with language server protocols, and Solvent for static type checking.
00:24:44
There are great tools available for linting, formatting, and static analysis.
00:25:03
Enhancing these tools will provide a better user experience.
00:25:17
Furthermore, we plan to continue improving Ruby's performance.
00:25:37
We can explore options like introducing better JIT compilation.
00:25:57
Java virtual machines, like Chrome and Firefox, use multi-layer JIT, performing optimized and lightweight compilations.
00:26:13
Considering a layered JIT could add significant performance benefits to Ruby.
00:26:29
We are looking into candidates for performance enhancement, such as MJ and Nuri.
00:26:45
Continuing work on supporting tools and performance will be a focus for us.
00:27:02
One idea on my mind is creating a smaller subset of Ruby.
00:27:18
This subset would be simpler, more strict, and hopefully faster to optimize.
00:27:30
It would be downward compatible, allowing traditional Ruby programs to run on this new version.
00:27:46
This experiment might lead to a more optimized Ruby.
00:27:58
We need to keep compatibility while exploring these new ideas.
00:28:12
Programming is exciting, and Ruby has the potential to make programming accessible and productive.
00:28:28
We aim to make the world a better place through programming.
00:28:45
Ruby enables programmers to become productive, and I encourage you to join this journey.
00:29:04
I am excited for the future of Ruby, and I appreciate your support.
00:29:18
Thank you for your attention today.
00:29:35
Wow! What a kick-off! Thank you so much, Matz, for providing us with a glimpse of what's coming in December.
00:30:08
Before we jump into the Q&A with Matz, let me tell you that the community track is about to start.
00:30:25
Don't go anywhere, or do, but Arno is ready to receive you there.
00:30:41
Bill is up next on the community track with a talk titled 'Fantastic Passwords and Where to Find Them.' Check it out; it's going to be a blast.
00:30:57
Unfortunately, we're experiencing some audio issues, but we are waiting for Matz to join us shortly.
00:31:12
Hi! Hey there! Thank you for joining us, Matz.
00:31:34
Are you missing these virtual conferences? Have you had many virtual conferences before?
00:31:48
I had a little keynote during a following conference, but this is mostly my first time interacting in this kind of format.
00:32:06
We have some questions from the audience. Ramon, can you read the first question?
00:32:23
Sure! The first question is: Do individual actors also have separate garbage collections?
00:32:39
No, we have one big garbage collector, but we can separate it by object spaces.
00:32:56
Ruby can share some objects among different actors.
00:33:09
Multiple people have asked if RBS works with dynamically generated classes, such as those generated by dry types.
00:33:27
Basically, no. For instance, libraries like Active Record dynamically generate classes at runtime.
00:33:38
Next question: if a method returns more than one variable with different types, which type will the checker assume?
00:33:49
The checker should treat that as a union type. If one method might return an integer in one condition and a string in another, the RBS should reflect that.
00:34:05
Another curious question: who is the turtle, and who is the bunny from your slides?
00:34:24
The turtle indicates the timer. My presentation was set for 30 minutes, and the turtle shows how much time I consumed.
00:34:38
The bunny represents the index of the slides, so if the bunny is slower than the turtle, it means I have more slides to cover.
00:34:52
Thank you for answering that! One last question for now.
00:35:08
Thank you for all the amazing feedback in the chat; so many people appreciate your work and how you've changed their lives.
00:35:24
The community has changed my life as well! Thank you all.
00:35:40
We are reaching the end of our Q&A session. Thank you very much for joining us today.
00:35:54
Thank you! Well, folks, we'll take a short break now, and we hope to see you back in five minutes for Penelope's talk.
00:36:06
Don't go anywhere!