From Fedora Project Wiki

Revision as of 15:55, 2 December 2020 by Vondruch (talk | contribs) (Created page with " <!-- The actual name of your proposed change page should look something like: Changes/Your_Change_Proposal_Name. This keeps all change proposals in the same namespace --> =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Ruby 3.0

Summary

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.

Owner

Current status

  • Targeted release: Fedora 34
  • Last updated: 2020-12-02
  • FESCo issue: <will be assigned by the Wrangler>
  • Tracker bug: <will be assigned by the Wrangler>
  • Release notes tracker: <will be assigned by the Wrangler>

Detailed Description

Ruby 3.0 is upstream's new major release of Ruby. Many new features and improvements are included.

RBS

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 (experimental)

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.

Scheduler (Experimental)

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#except is now built-in.
  • Memory view is added as an experimental feature

Performance improvements

Many improvements were implemented in MJIT.

Other notable changes since 2.7

  • Keyword arguments are separated from other arguments.
  • The feature of $SAFE was 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.

Feedback

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.

Scope

  • 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:

Upgrade/compatibility impact

  • User specific Ruby binary extensions need to be rebuild.

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.

User Experience

The Ruby programs/scripts should behave as they were used to.

Dependencies

$ dnf repoquery --disablerepo=* --enablerepo=rawhide --enablerepo=rawhide-source --arch=src --whatrequires 'ruby-devel' | sort | uniq | wc -l
138

Contingency Plan

  • 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

Documentation

Release Notes

  • 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.

https://github.com/ruby/ruby/blob/master/NEWS