ruby/spec already contains some specs for 3.3, but we should aim to cover all new features and important changes.
This will improve the test coverage of these features (and maybe discover a few bugs along the way), allow other Ruby implementations to implement the changes faster with more confidence and document clearly the new behavior.
The new specs should be within a version guard block:
ruby_version_is "3.3" do
# New specs
end
NOTE: https://rubyreferences.github.io/rubychanges/3.3.html gives more details for many features and changes.
From https://github.com/ruby/ruby/blob/master/doc/NEWS/NEWS-3.3.0.md:
NEWS for Ruby 3.3.0
Core classes updates
Note: We're only listing outstanding class updates.
Array
Dir
Encoding
Fiber
fiber = Fiber.new do
while true
puts "Yielding..."
Fiber.yield
end
ensure
puts "Exiting..."
end
fiber.resume
# Yielding...
fiber.kill
# Exiting...
MatchData
Module
ObjectSpace::WeakKeyMap
ObjectSpace::WeakMap
Proc
Process
Process::Status
Range
Refinement
Regexp
String
Thread::Queue
Thread::SizedQueue
Time
Time.new('2023-12-20')
# no time information (ArgumentError)
TracePoint
Socket
Random
Compatibility issues
C API updates
rb_postponed_job updates
Some updates for internal thread event hook APIs
IO related updates:
ruby/spec already contains some specs for 3.3, but we should aim to cover all new features and important changes.
This will improve the test coverage of these features (and maybe discover a few bugs along the way), allow other Ruby implementations to implement the changes faster with more confidence and document clearly the new behavior.
The new specs should be within a version guard block:
NOTE: https://rubyreferences.github.io/rubychanges/3.3.html gives more details for many features and changes.
From https://github.com/ruby/ruby/blob/master/doc/NEWS/NEWS-3.3.0.md:
NEWS for Ruby 3.3.0
Core classes updates
Note: We're only listing outstanding class updates.
Array
Dir
by the provided directory file descriptor. [Feature #19347]
by the provided directory file descriptor. [Feature #19347]
the provided
Dirobject. [Feature #19347]Encoding
Encoding#replicatehas been removed, it was already deprecated. [Feature #18949]Fiber
MatchData
symbolize_nameskeyword. [Feature #19591]
Module
module. [Feature #19521]
ObjectSpace::WeakKeyMap
The class use equality semantic to lookup keys like a regular hash,
but it doesn't hold strong references on the keys. [Feature #18498]
ObjectSpace::WeakMap
entries. [Feature #19561]
Proc
#initialize_dupand#initialize_clonehooks respectively. [Feature #19362]
Process
and that now is a good time to optimize the application. This is useful
for long-running applications. The actual optimizations performed are entirely
implementation-specific and may change in the future without notice. [Feature #18885]
Process::Status
Range
Refinement
Refinement#refined_class is deprecated and will be removed in Ruby
3.4. [Feature #19714]
Regexp
for Regexp containing these extensions can now also be performed in linear time to the length
of the input string. However, these cannot contain captures and cannot be nested. [Feature #19725]
String
source string to be copied. [Feature #19314]
Thread::Queue
Thread::SizedQueue
Time
TracePoint
rescueevent. When the raised exception was rescued,the TracePoint will fire the hook.
rescueevent only supports Ruby-levelrescue. [Feature #19572]Socket
Socket#recv and Socket#recv_nonblock returns
nilinstead of an empty string on closedconnections. Socket#recvmsg and Socket#recvmsg_nonblock returns
nilinstead of an empty packet on closedconnections. [Bug #19012]
Name resolution such as Socket.getaddrinfo, Socket.getnameinfo, Addrinfo.getaddrinfo, etc.
can now be interrupted. [Feature #19965]
Random
charskeyword argument. [Feature #18183]
Compatibility issues
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]
itcalls without arguments in a block with no ordinary parameters aredeprecated.
itwill 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
#inspectfor efficiency, and says "instance of ClassName" instead. [Feature #18285]
Now anonymous parameters forwarding is disallowed inside a block
that uses anonymous parameters. [Feature #19370]
C API updates
rb_postponed_jobupdatesrb_postponed_job_preregister()rb_postponed_job_trigger()rb_postponed_job_register()(and semantic change. see below)rb_postponed_job_register_one()To solve the issue, we introduced new two APIs and deprecated current APIs.
The semantics of these functions have also changed slightly;
rb_postponed_job_registernow behaves like the
oncevariant in that multiple calls with the samefuncmight be coalesced into a single execution of thefunc[Feature #20057]
Some updates for internal thread event hook APIs
rb_internal_thread_event_data_twith a target Ruby thread (VALUE)and callback functions (
rb_internal_thread_event_callback) receive it.GVL Instrumentation: pass thread->self as part of event data ruby#8885
from internal thread event hook APIs (they are introduced since Ruby 3.2).
Thread specific storages APIs ruby#8936
rb_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 froma specific thread.
[Feature #10602]
rb_data_define()is introduced to defineData. [Feature #19757]rb_ext_resolve_symbol()is introduced to search a function fromextension libraries. [Feature #20005]
IO related updates:
rb_io_twill be hidden and deprecated attributesare added for each members. [Feature #19057]
rb_io_path(VALUE io)is introduced to get a path ofio.rb_io_closed_p(VALUE io)to get opening or closing ofio.rb_io_mode(VALUE io)to get the mode ofio.rb_io_open_descriptor()is introduced to make an IO object from a filedescriptor.