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
- Name: Vít Ondruch
- Email: vondruch@redhat.com
- Name: Mamoru Tasaka
- Email: mtasaka@fedoraproject.org
Current status
- Targeted release: Fedora Linux 42
- Last updated: 2024-12-16
- Announced
- Discussion thread
- FESCo issue: #3302
- Tracker bug: <will be assigned by the Wrangler>
- Release notes tracker: <will be assigned by the Wrangler>
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.
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]]
Core classes updates
- Exception
Exception#set_backtrace
now accepts an array ofThread::Backtrace::Location
.Kernel#raise
,Thread#raise
andFiber#raise
also accept this new format.
- Range
Range#size
now raisesTypeError
if the range is not iterable.
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}'
- Symbol keys are displayed using the modern symbol key syntax:
C API updates
rb_newobj
andrb_newobj_of
(and corresponding macrosRB_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
orInteger#+
now emits a performance class warning (-W:performance
orWarning[: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
- Proposal owners:
- Finish packaging of Ruby 3.4. Current changes available in PR https://src.fedoraproject.org/rpms/ruby/pull-request/196
- Rebuilding of Ruby packages providing native extensions (i.e. packages which depends on libruby).
- 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
- Help and documentation for the Ruby programming language
- Ruby 3.4.0 NEWS
- Ruby 3.4.0 preview2 release announcement
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.