Posted by naruse on 16 May 2024
We are pleased to announce the release of Ruby 3.4.0-preview1.
Language changes
-
String literals in files without a
frozen_string_literal
comment now behave as if they were frozen. If they are mutated a deprecation warning is emitted. These warnings can be enabled with-W:deprecated
or by settingWarning[:deprecated] = true
. To disable this change, you can run Ruby with the--disable-frozen-string-literal
command line argument. [Feature #20205] -
it
is added to reference a block parameter. [Feature #18980] -
Keyword splatting
nil
when calling methods is now supported.**nil
is treated similarly to**{}
, passing no keywords, and not calling any conversion methods. [Bug #20064] -
Block passing is no longer allowed in index. [Bug #19918]
-
Keyword arguments are no longer allowed in index. [Bug #20218]
Core classes updates
Note: We’re only listing outstanding class updates.
-
Exception
- Exception#set_backtrace now accepts arrays of
Thread::Backtrace::Location
.Kernel#raise
,Thread#raise
andFiber#raise
also accept this new format. [Feature #13557]
- Exception#set_backtrace now accepts arrays of
-
Range
- Range#size now raises TypeError if the range is not iterable. [Misc #18984]
Compatibility issues
Note: Excluding feature bug fixes.
- Error messages and backtrace displays have been changed.
- Use a single quote instead of a backtick as a opening quote. [Feature #16495]
- Display a class name before a method name (only when the class has a permanent name). [Feature #19117]
Kernel#caller
,Thread::Backtrace::Location
’s methods, etc. are also changed accordingly.
Old: test.rb:1:in `foo': undefined method `time' for an instance of Integer from test.rb:2:in `<main>' New: test.rb:1:in 'Object#foo': undefined method 'time' for an instance of Integer from test.rb:2:in '<main>'
C API updates
rb_newobj
andrb_newobj_of
(and corresponding macrosRB_NEWOBJ
,RB_NEWOBJ_OF
,NEWOBJ
,NEWOBJ_OF
) have been removed. [Feature #20265]- Removed deprecated function
rb_gc_force_recycle
. [Feature #18290]
Implementation improvements
Array#each
is rewritten in Ruby for better performance [Feature #20182].
Miscellaneous changes
-
Passing a block to a method which doesn’t use the passed block will show a warning on verbose mode (
-w
). [Feature #15554] -
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
). [Feature #20429]
See GitHub releases like Logger or changelog for details of the default gems or bundled gems.
See NEWS or commit logs for more details.
With those changes, 3283 files changed, 107449 insertions(+), 115380 deletions(-) since Ruby 3.3.0!
Download
-
https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.0-preview1.tar.gz
SIZE: 22507726 SHA1: 1619cbe06b5a8c774711b3351d18bb0f84f1d017 SHA256: 1a3c322e90cb22e5fba0b5d257bb2be9988affa3867eba7642ed981fdde895bb SHA512: 29c0e32179f7b823b6708f5328e495cd333fe8dd88f7df7d9051deab47add67b14d899bba565bba1a77e1b04c9693d9708541445c112925777bb6891cb7b2b62
-
https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.0-preview1.tar.xz
SIZE: 16709536 SHA1: 6041ad2651527d01c36106de3d3cdab680ed3132 SHA256: 4ee4ec44366050d4b2ee1d88034cc63e0b9174a1a6650285777f3d3447213a97 SHA512: 4ce306b9beb1e2d88c76d7f809724b66bed17e354c07a2b54aa050fc2035652e4d83deadc8dbf7a375bbdb1c816f2996334bb8e7ff5e6c24b71a858bf6b0cb7c
-
https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.0-preview1.zip
SIZE: 27731060 SHA1: 5d79834050369ea9241d86467bf93e9e89e2ab7a SHA256: bd2a6c0e8396698e6f6768c00b0f155510859bb6fb92420f7b7abec610e71dbb SHA512: 36ea6897e6ad769141516f4c1bb18989fbde27a76f0f3abcce947f8b6b79639846ba93907e085181f7d305ab06ad73f1bbb37928049c8c951d33176ee444abbf
What is Ruby
Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993, and is now developed as Open Source. It runs on multiple platforms and is used all over the world especially for web development.