doc/NEWS/NEWS-3.3.0.md
This document is a list of user-visible feature changes since the 3.2.0 release, except for bug fixes.
Note that each entry is kept to a minimum, see links for details.
A new performance warning category was introduced.
They are not displayed by default even in verbose mode.
Turn them on with -W:performance or Warning[:performance] = true. [Feature #19538]
A new RUBY_CRASH_REPORT environment variable was introduced to allow
redirecting Ruby crash reports to a file or sub command. See the BUG REPORT ENVIRONMENT
section of the ruby manpage for further details. [Feature #19790]
Note: We're only listing outstanding class updates.
Array
Dir
Dir object. [Feature #19347]Encoding
Encoding#replicate has been removed, it was already deprecated. [Feature #18949]Fiber
Introduce Fiber#kill. [Bug #595]
fiber = Fiber.new do
while true
puts "Yielding..."
Fiber.yield
end
ensure
puts "Exiting..."
end
fiber.resume
# Yielding...
fiber.kill
# Exiting...
MatchData
symbolize_names
keyword. [Feature #19591]Module
ObjectSpace::WeakKeyMap
ObjectSpace::WeakMap
Proc
#initialize_dup and #initialize_clone
hooks respectively. [Feature #19362]Process
Process::Status
Range
Refinement
Regexp
String
Thread::Queue
Thread::SizedQueue
Time
Time.new with a string argument became stricter. [Bug #19293]
Time.new('2023-12-20')
# no time information (ArgumentError)
TracePoint
rescue event. When the raised exception was rescued,
the TracePoint will fire the hook. rescue event only supports Ruby-level
rescue. [Feature #19572]RubyGems and Bundler warn if users do require the following gems without adding them to Gemfile or gemspec.
This is because they will become the bundled gems in the future version of Ruby. This warning is suppressed
if you use bootsnap gem. We recommend to run your application with DISABLE_BOOTSNAP=1 environmental variable
at least once. This is limitation of this version.
[Feature #19351] [Feature #19776] [Feature #19843]
Socket#recv and Socket#recv_nonblock returns nil instead of an empty string on closed
connections. Socket#recvmsg and Socket#recvmsg_nonblock returns nil instead of an empty packet on closed
connections. [Bug #19012]
Name resolution such as Socket.getaddrinfo, Socket.getnameinfo, Addrinfo.getaddrinfo, etc. can now be interrupted. [Feature #19965]
Random::Formatter#alphanumeric is extended to accept optional chars
keyword argument. [Feature #18183]
The following default gem is added.
The following default gems are updated.
The following bundled gem is promoted from default gems.
The following bundled gems are updated.
See GitHub releases like Logger or changelog for details of the default gems or bundled gems.
Prism.parse(source) which returns the AST as part of a parse result objectPrism.parse_comments(source) which returns the commentsPrism.parse_success?(source) which returns true if there are no errorsruby --parser=prism or RUBYOPT="--parser=prism" to experiment with the Prism compiler. Please note that this flag is for debugging only.Subprocess creation/forking via the following file open methods is deprecated. [Feature #19630]
When given a non-lambda, non-literal block, Kernel#lambda with now raises
ArgumentError instead of returning it unmodified. These usages have been
issuing warnings under the Warning[:deprecated] category since Ruby 3.0.0.
[Feature #19777]
The RUBY_GC_HEAP_INIT_SLOTS environment variable has been deprecated and
removed. Environment variables RUBY_GC_HEAP_%d_INIT_SLOTS should be
used instead. [Feature #19785]
it calls without arguments in a block with no ordinary parameters are
deprecated. it will be a reference to the first block parameter in Ruby 3.4.
[Feature #18980]
Error message for NoMethodError have changed to not use the target object's #inspect
for efficiency, and says "instance of ClassName" instead. [Feature #18285]
([1] * 100).nonexisting
# undefined method `nonexisting' for an instance of Array (NoMethodError)
Now anonymous parameters forwarding is disallowed inside a block that uses anonymous parameters. [Feature #19370]
racc is promoted to bundled gems.
racc to your Gemfile if you use racc under bundler environment.ext/readline is retired
reline that is pure Ruby implementation compatible with ext/readline API.
We rely on reline in the future. If you need to use ext/readline, you can install
ext/readline via rubygems.org with gem install readline-ext.libreadline or libedit.rb_postponed_job updates
rb_postponed_job_preregister()rb_postponed_job_trigger()rb_postponed_job_register() (and semantic change. see below)rb_postponed_job_register_one()rb_postponed_job_register
now behaves like the once variant in that multiple calls with the same
func might be coalesced into a single execution of the func
[Feature #20057]Some updates for internal thread event hook APIs
rb_internal_thread_event_data_t with a target Ruby thread (VALUE)
and callback functions (rb_internal_thread_event_callback) receive it.
https://github.com/ruby/ruby/pull/8885rb_internal_thread_specific_key_create()rb_internal_thread_specific_get()rb_internal_thread_specific_set()rb_profile_thread_frames() is introduced to get a frames from
a specific thread.
[Feature #10602]
rb_data_define() is introduced to define Data. [Feature #19757]
rb_ext_resolve_symbol() is introduced to search a function from
extension libraries. [Feature #20005]
IO related updates:
rb_io_t will be hidden and deprecated attributes
are added for each members. [Feature #19057]rb_io_path(VALUE io) is introduced to get a path of io.rb_io_closed_p(VALUE io) to get opening or closing of io.rb_io_mode(VALUE io) to get the mode of io.rb_io_open_descriptor() is introduced to make an IO object from a file
descriptor.(?, *, +) are supported, it will be used in Ruby parse.y.REMEMBERED_WB_UNPROTECTED_OBJECTS_LIMIT_RATIO tuning variable was
introduced to control the number of unprotected objects cause a major GC
collection to trigger. The default is set to 0.01 (1%). This significantly
reduces the frequency of major GC collection. [Feature #19571]Time, Enumerator, MatchData, Method, File::Stat, BigDecimal
and several others. This significantly reduces minor GC collection time and major
GC collection frequency.Hash, Time,
Thread::Backtrace, Thread::Backtrace::Location, File::Stat, Method.
This makes these classes faster to allocate and free, use less memory and reduce
heap fragmentation.defined?(@ivar) is optimized with Object Shapes.#blank? and
specialized #present? are inlined.Integer#*, Integer#!=, String#!=, String#getbyte,
Kernel#block_given?, Kernel#is_a?, Kernel#instance_of?, and Module#===
are specially optimized.--yjit-call-threshold is automatically raised from 30 to 120
when the application has more than 40,000 ISEQs.--yjit-cold-threshold is added to skip compiling cold ISEQs.--yjit-exec-mem-size is treated as a hard limit where compilation of new code stops.--yjit-code-gcRubyVM::YJIT.enable that can enable YJIT at run-time
--yjit-disable can be used if you want to use other
YJIT options while disabling YJIT at boot.yjit_alloc_size and several more metadata-related stats are now available by default.ratio_in_yjit stat produced by --yjit-stats is now available in release builds,
a special stats or dev build is no longer required to access most stats.--yjit-perf is added to facilitate profiling with Linux perf.--yjit-trace-exits now supports sampling with --yjit-trace-exits-sample-rate=N--yjit-stats=quiet is added to avoid printing stats on exit.--disable-jit-support is removed. Consider using --disable-yjit --disable-rjit instead.RUBY_MN_THREADS=1 environment variable will enable it.
On non-main Ractors, M:N thread scheduler is enabled (and can not
disable it now).N (the number of native threads) can be specified with RUBY_MAX_CPU
environment variable. The default is 8.
Note that more than N native threads are used to support many kind of
blocking operations.