What's New in Ruby 4.0
a day ago
- #JIT Compiler
- #Programming
- #Ruby 4.0
- Ruby 4.0 is set to release on Christmas day, marking 30 years since Ruby's first public release.
- Introduces Ruby::Box, an experimental feature for isolated namespaces, allowing loading multiple library versions simultaneously.
- Ractor's API has been redesigned to use Ractor::Port for inter-ractor communication, replacing Ractor.yield and Ractor#take.
- A new JIT compiler, ZJIT, has been added, though YJIT remains recommended for production use.
- Logical operators (and, or, &&, ||) can now be placed on the next line for improved readability.
- The Ruby top-level module now includes constants like Ruby::VERSION and Ruby::DESCRIPTION.
- instance_variables_to_inspect allows customization of inspect output to exclude certain instance variables.
- Array#rfind and Array#find have been introduced for more efficient element searching.
- Performance improvements include over 2x faster object allocations without JIT and nearly 4x with JIT.
- Set and Pathname are now core classes, and the CGI library has been removed from default gems, with some methods retained.