The development team behind the dynamic and object-oriented programming language Ruby has released version 3.4. There are some new features in the update, including a new feature it
-New functionality for keywords, Prism and YJIT as default parsers.
Advertisement
This is keyword and prism
is keyword in ruby 3.4 it
In stuff, that should make referencing block parameters easier. it behaves like that _1
But provides a way to use the first block parameter in one-liners without additional numeric parameters. _2
Have to keep this in mind. The innovation aims to reduce cognitive load when reading code that only uses the first parameter.
The default parser was changed to Prism in Ruby 3.4. According to the announcement post, this is an internal adjustment that will bring barely noticeable changes to most users – it is intended to optimize parser performance and stability.
Support for Happy Eyeballs 2
The socket library in Ruby 3.4.0 supports Happy Eyeballs version 2 (RFC 8305), which improves network connections. Happy Eyeballs is an algorithm that minimizes network connection latency by attempting to establish and attempt IPv6 and IPv4 connections and using the fastest successful connection.
News for YJIT
Ruby 3.4 introduced several new features in YJIT (Yet Another Just-in-Time Compiler), a just-in-time compiler for Ruby designed to run more efficient machines by repeatedly executing Ruby methods. Designed to improve the execution performance of Ruby programs by translating them into code. Runtime. This results in faster execution of Ruby programs, especially for computationally intensive tasks.
The update has improved performance on x86-64 and ARM64 platforms, reducing memory consumption through compressed metadata and integrated memory limits. The development team introduces new command line options like --yjit-mem-size
For more intuitive storage management and --yjit-log
To create a compilation log.
The update also includes new optimizations, such as inlining of small methods. Inlining is an optimization technique in which a method’s code is inserted directly into the calling code block to reduce the overhead of a function call and increase execution speed.
change in language
Ruby 3.4 introduced several changes to the language. Ruby now issues a deprecation warning when string literals are contained in a file without frozen_string_literal
-Comments can be changed. Furthermore, there will be **nil
When keyword splatting occurs, it is treated as if no keywords were passed. **{}
Keyword splicing in Ruby allows you to create a hash or nil
Through **
Keyword to be passed to a method as argument, where **nil
It is treated as if no keyword arguments were passed.
Passing blocks and using keyword arguments in index methods are no longer allowed in Ruby 3.4. Also the top level name is ::Ruby
is now reserved, and its definition generates a warning if Warning(:deprecated)
Is active.
More about Ruby 3.4 announcement post offer On the official programming language website.
(MDO)