Ruby 3.0 is the latest stable version of Ruby. Many new features and improvements are included for the increasingly diverse and expanding demands for Ruby. With this major update from Ruby 2.7 in Fedora 33 to Ruby 3.0 in Fedora 34, Fedora becomes the superior Ruby development platform.
- Targeted release: Fedora 34
- Last updated: 2021-01-07
- FESCo issue: #2518
- Tracker bug: #1909786
- Release notes tracker: #620
Ruby 3.0 is upstream's new major release of Ruby. Many new features and improvements are included.
RBS is a language to describe the types of Ruby programs. Type checkers including type-profiler and other tools supporting RBS will understand Ruby programs much better with RBS definitions.
You can write down the definition of classes and modules: methods defined in the class, instance variables and their types, and inheritance/mix-in relations. The goal of RBS is to support commonly seen patterns in Ruby programs and it allows writing advanced types including union types, method overloading, and generics. It also supports duck typing with interface types.
Ruby 3.0 ships with
rbs gem, which allows parsing and processing type definitions written in RBS.
Ractor is an Actor-model like concurrent abstraction designed to provide a parallel execution feature without thread-safety concerns.
You can make multiple ractors and you can run them in parallel. Ractor enables to make thread-safe parallel programs because ractors can not share normal objects. Communication between ractors are supported by message passing.
To limit sharing objects, Ractor introduces several restrictions to the Ruby’s syntax (without multiple Ractors, there is no changes).
The specification and implementation are not matured and changed in future, so this feature is marked as experimental and show the experimental feature warning if Ractor is created.
Thread#scheduler is introduced for intercepting blocking operations. This allows for light-weight concurrency without changing existing code.
CAUTION: This feature is strongly experimental. Both the name and feature will change in next preview release.
Other Notable New Features
- Rightward assignment statement is added.
- Endless method definition is added.
- Find pattern is added.
Hash#exceptis now built-in.
- Memory view is added as an experimental feature
Many improvements were implemented in MJIT.
Other notable changes since 2.7
- Keyword arguments are separated from other arguments.
- The feature of
$SAFEwas completely removed; now it is a normal global variable.
- The order of backtrace had been reversed at Ruby 2.5, but it was cancelled. Now it behaves like Ruby 2.4; an error message and the line number where the exception occurs are printed first, and its callers are printed later.
- Some standard libraries are updated.
Benefit to Fedora
With a latest release, Ruby language is supporting the newest language features, which enables even faster and easier development of Ruby applications.
- Proposal owners:
- Finish packaging of Ruby 3.0. Current changes available in PR https://src.fedoraproject.org/rpms/ruby/pull-request/70
- Rebuilding of Ruby packages providing native extensions (i.e. packages which depends on libruby).
- Other developers: N/A (not a System Wide Change)
- Rebuild of packages with binary extensions (i.e. packages which depends on libruby) will be handled automatically, but some packages might need fixes/updates to support Ruby 3.0 properly.
- Release engineering: #9882 (a check of an impact with Release Engineering is needed)
- The packages are going to be rebuild in side-tag, but that does not need releng involvement nowadays.
- Policies and guidelines: N/A (not a System Wide Change)
- Trademark approval: N/A (not needed for this Change)
- Alignment with Objectives:
- User specific Ruby binary extensions need to be rebuild.
- Ruby packages/application dependencies might need to be adjusted if net-telnet, xmlrpc, webrick gem are used.
How To Test
- No special hardware is needed.
- To test, install Ruby 3.0. The test builds are pusblished in PR or on Ruby-SIG ML
- Try to locally rebuild your packages using Ruby 3.0.
- Use the packages with your applications previously written in Ruby.
- If something doesn't work as it should, let us know.
The Ruby programs/scripts should behave as they were used to.
$ dnf repoquery --disablerepo=* --enablerepo=rawhide --enablerepo=rawhide-source --arch=src --whatrequires 'ruby-devel' | sort | uniq | wc -l 138
- Contingency mechanism: We would like to get a special buildroot tag to be able to rebuild necessary the packages with Ruby 3.0. If anything goes wrong, the tag could be easily dropped and previous version of Ruby 2.7 and its dependencies stays intact. The tag would be merged into F34 after everything is rebuild.
- Contingency deadline: Mass Rebuild
- Blocks release? No (not a System Wide Change), Yes/No
- Blocks product? No
- Help and documentation for the Ruby programming language
- Ruby 3.0.0 NEWS
- Ruby 3.0 release announcement
- The Ruby 3.0 bumps soname, therefore Ruby packages, which use binary extensions, should be rebuilt. Nevertheless, since upstream paid great attention to source compatibility, no changes to your code are needed.