From Fedora Project Wiki
mNo edit summary
(adding tracker bug)
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
= Ruby 3.4 =
= Ruby 3.4 =


{{Change_Proposal_Banner}}


== Summary ==
== Summary ==
Line 25: Line 24:


== Current status ==
== Current status ==
[[Category:ChangeReadyforFesco]]
[[Category:ChangeAcceptedF42]]
<!-- When your change proposal page is completed and ready for review and announcement -->
<!-- When your change proposal page is completed and ready for review and announcement -->
<!-- remove Category:ChangePageIncomplete and change it to Category:ChangeReadyForWrangler -->
<!-- remove Category:ChangePageIncomplete and change it to Category:ChangeReadyForWrangler -->
Line 45: Line 44:
* [https://discussion.fedoraproject.org/t/f42-change-proposal-ruby-3-4-system-wide/138984 Discussion thread]
* [https://discussion.fedoraproject.org/t/f42-change-proposal-ruby-3-4-system-wide/138984 Discussion thread]
* FESCo issue: [https://pagure.io/fesco/issue/3302 #3302]
* FESCo issue: [https://pagure.io/fesco/issue/3302 #3302]
* Tracker bug: <will be assigned by the Wrangler>
* Tracker bug: [https://bugzilla.redhat.com/show_bug.cgi?id=2335929 #2335929]
* Release notes tracker: <will be assigned by the Wrangler>
* Release notes tracker: <will be assigned by the Wrangler>


Line 56: Line 55:


Switch the default parser from parse.y to Prism to improve maintainability, error tolerance, portability, and performance.
Switch the default parser from parse.y to Prism to improve maintainability, error tolerance, portability, and performance.
=== The socket library now features Happy Eyeballs Version 2 (RFC 8305) ===
The socket library now features Happy Eyeballs Version 2 (RFC 8305), the latest standardized version of a widely adopted approach for better connectivity in many programming languages, in TCPSocket.new (TCPSocket.open) and Socket.tcp. This improvement enables Ruby to provide efficient and reliable network connections, adapted to modern internet environments.
=== YJIT ===
* Better performance across most benchmarks on both x86-64 and arm64 platforms.
* Reduced memory usage through compressed metadata and a unified memory limit.
* Various bug fixes: YJIT is now more robust and thoroughly tested.


=== Language changes ===
=== Language changes ===
Line 64: Line 73:
* Block passing is no longer allowed in index.
* Block passing is no longer allowed in index.
* Keyword arguments are no longer allowed in index.#20218]]
* Keyword arguments are no longer allowed in index.#20218]]
* The toplevel name `::Ruby` is reserved now.


=== Core classes updates ===
=== Core classes updates ===
Line 69: Line 79:
* Exception
* Exception
** `Exception#set_backtrace` now accepts an array of `Thread::Backtrace::Location`. `Kernel#raise`, `Thread#raise` and `Fiber#raise` also accept this new format.
** `Exception#set_backtrace` now accepts an array of `Thread::Backtrace::Location`. `Kernel#raise`, `Thread#raise` and `Fiber#raise` also accept this new format.
* GC
** `GC.config` added to allow setting configuration variables on the Garbage Collector.
** GC configuration parameter `rgengc_allow_full_mark` introduced.
* Ractor
** `require` in Ractor is allowed. The requiring process will be run on the main Ractor. `Ractor._require(feature)` is added to run requiring process on the main Ractor.
** `Ractor.main?` is added.
** `Ractor.[]` and `Ractor.[]=` are added to access the ractor local storage of the current Ractor.
** `Ractor.store_if_absent(key){ init }` is added to initialize ractor local variables in thread-safty.
* Range
* Range
** `Range#size` now raises `TypeError` if the range is not iterable.
** `Range#size` now raises `TypeError` if the range is not iterable.
=== Standard Library updates ===
* RubyGems
** Add `--attestation` option to gem push. It enabled to store signature to sigstore.dev
* Bundler
** Add a `lockfile_checksums` configuration to include checksums in fresh lockfiles
** Add bundle lock `--add-checksums` to add checksums to an existing lockfile
* JSON
** Performance improvements of `JSON.parse` about 1.5 times faster than json-2.7.x.
* Tempfile
** The keyword argument `anonymous: true` is implemented for `Tempfile.create`. `Tempfile.create(anonymous: true)` removes the created temporary file immediately. So applications don’t need to remove the file.


=== Compatibility issues ===
=== Compatibility issues ===
Line 226: Line 256:
* [http://www.ruby-doc.org/ Help and documentation for the Ruby programming language]
* [http://www.ruby-doc.org/ Help and documentation for the Ruby programming language]
* [https://github.com/ruby/ruby/blob/ruby_3_4/NEWS.md Ruby 3.4.0 NEWS]
* [https://github.com/ruby/ruby/blob/ruby_3_4/NEWS.md Ruby 3.4.0 NEWS]
* [https://www.ruby-lang.org/en/news/2024/10/07/ruby-3-4-0-preview2-released/ Ruby 3.4.0 preview2 release announcement]
* [https://www.ruby-lang.org/en/news/2024/12/25/ruby-3-4-0-released/ Ruby 3.4.0 release announcement]


== Release Notes ==
== Release Notes ==

Latest revision as of 18:48, 6 January 2025


Ruby 3.4

Summary

Ruby 3.4 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 3.3 in Fedora 41 to Ruby 3.4 in Fedora 42, Fedora becomes the superior Ruby development platform.

Owner

Current status

Detailed Description

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

Prism

Switch the default parser from parse.y to Prism to improve maintainability, error tolerance, portability, and performance.

The socket library now features Happy Eyeballs Version 2 (RFC 8305)

The socket library now features Happy Eyeballs Version 2 (RFC 8305), the latest standardized version of a widely adopted approach for better connectivity in many programming languages, in TCPSocket.new (TCPSocket.open) and Socket.tcp. This improvement enables Ruby to provide efficient and reliable network connections, adapted to modern internet environments.

YJIT

  • Better performance across most benchmarks on both x86-64 and arm64 platforms.
  • Reduced memory usage through compressed metadata and a unified memory limit.
  • Various bug fixes: YJIT is now more robust and thoroughly tested.

Language changes

  • String literals in files without a frozen_string_literal comment now emit a deprecation warning when they are mutated.
  • it is added to reference a block parameter.
  • Keyword splatting nil when calling methods is now supported.**nil is treated similarly to **{}, passing no keywords, and not calling any conversion methods.
  • Block passing is no longer allowed in index.
  • Keyword arguments are no longer allowed in index.#20218]]
  • The toplevel name ::Ruby is reserved now.

Core classes updates

  • Exception
    • Exception#set_backtrace now accepts an array of Thread::Backtrace::Location. Kernel#raise, Thread#raise and Fiber#raise also accept this new format.
  • GC
    • GC.config added to allow setting configuration variables on the Garbage Collector.
    • GC configuration parameter rgengc_allow_full_mark introduced.
  • Ractor
    • require in Ractor is allowed. The requiring process will be run on the main Ractor. Ractor._require(feature) is added to run requiring process on the main Ractor.
    • Ractor.main? is added.
    • Ractor.[] and Ractor.[]= are added to access the ractor local storage of the current Ractor.
    • Ractor.store_if_absent(key){ init } is added to initialize ractor local variables in thread-safty.
  • Range
    • Range#size now raises TypeError if the range is not iterable.

Standard Library updates

  • RubyGems
    • Add --attestation option to gem push. It enabled to store signature to sigstore.dev
  • Bundler
    • Add a lockfile_checksums configuration to include checksums in fresh lockfiles
    • Add bundle lock --add-checksums to add checksums to an existing lockfile
  • JSON
    • Performance improvements of JSON.parse about 1.5 times faster than json-2.7.x.
  • Tempfile
    • The keyword argument anonymous: true is implemented for Tempfile.create. Tempfile.create(anonymous: true) removes the created temporary file immediately. So applications don’t need to remove the file.

Compatibility issues

  • Error messages and backtrace displays have been changed.
    • Use a single quote instead of a backtick as a opening quote.
    • Display a class name before a method name (only when the class has a permanent name).
    • Kernel#caller, Thread::Backtrace::Location's methods, etc. are also changed accordingly.
  • Hash#inspect rendering has changed.
    • Symbol keys are displayed using the modern symbol key syntax: "{user: 1}"
    • Other keys now have spaces around =>: '{"user" => 1}', while previously they didn't: '{"user"=>1}'

C API updates

  • rb_newobj and rb_newobj_of (and corresponding macros RB_NEWOBJ, RB_NEWOBJ_OF, NEWOBJ, NEWOBJ_OF) have been removed.
  • Removed deprecated function rb_gc_force_recycle.

Implementation improvements

  • Array#each is rewritten in Ruby for better performance.

Miscellaneous changes

  • Passing a block to a method which doesn't use the passed block will show a warning on verbose mode (-w).
  • Redefining some core methods that are specially optimized by the interpeter and JIT like String.freeze or Integer#+ now emits a performance class warning (-W:performance or Warning[:performance] = true).

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:
    • 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.4 properly.
  • Release engineering: #12469
    • The packages are going to be rebuild in side-tag, but that does not need releng involvement nowadays.
  • Policies and guidelines: N/A (not needed for this Change)
  • Trademark approval: N/A (not needed for this Change)
  • Alignment with the Fedora Strategy:

Upgrade/compatibility impact

  • User specific Ruby binary extensions need to be rebuild.
  • Adjustments to new language features will be needed.
  • Ruby packages/application dependencies might need to be adjusted if newly bundled gems are used.

Early Testing (Optional)

Do you require 'QA Blueprint' support? No

How To Test

  • No special hardware is needed.
  • To test, install Ruby 3.4. The test builds are published in PR or on Ruby-SIG ML
  • Try to locally rebuild your packages using Ruby 3.4.
  • 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
122

Contingency Plan

  • Contingency mechanism: We would like to get a special buildroot tag to be able to rebuild necessary the packages with Ruby 3.4. If anything goes wrong, the tag could be easily dropped and previous version of Ruby 3.3 and its dependencies stays intact. The tag would be merged into F42 after everything is rebuild.
  • Contingency deadline: Mass Rebuild
  • Blocks release? No


Documentation

Release Notes

  • The Ruby 3.4 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/ruby_3_4/NEWS.md