16 C
New York
Saturday, May 18, 2024

Ruby steps towards frozen string literals

The following model of the Ruby programming language, Ruby 3.4.0, has been launched in preview, bringing adjustments for string literals and sophistication updates.

Unveiled Might 16, the Ruby 3.4.0 preview is downloadable from ruby-lang.org. With this replace, string literals in information with no frozen_string_literal remark now behave as in the event that they have been frozen. If mutated, a deprecation warning is emitted. The change marks a primary step towards making frozen string literals the default in Ruby. Frozen or immutable strings provide each efficiency and security benefits.

In different language adjustments, key phrase splatting nil when calling strategies now could be supported, whereas block passing and key phrase arguments are now not allowed in indexes.

Ruby 3.4.0 additionally introduces two core class updates. First, Exception#set_backtrace now accepts arrays of Thread::Backtrace::Location, and Kernel#elevate, Thread#elevate, and Fiber#elevate settle for this new format as nicely. Second, Vary#dimension now raises TypeError if the vary isn’t iterable.

Error messages and backtrace shows have been modified to handle compatibility points. Builders now can use a single quote as a substitute of a backtick as a gap quote. Additionally it is now allowed to show a category title earlier than a technique title when the category has a everlasting title.

In different enhancements, Array#every has been rewritten for higher efficiency. Passing a block to a technique that doesn’t use the handed block now will present a warning in verbose mode. And redefining some core strategies which are specifically optimized by the interpreter and JIT now will emit a efficiency class warning.

Ruby 3.4.0 follows predecessors together with final month’s Ruby 3.2.4 launch, which introduced safety fixes, and the Christmas 2023 Ruby 3.3.0 launch, which featured the Prism parser. Ruby itself dates again to a 1995 preliminary public launch.

Copyright © 2024 IDG Communications, Inc.

Supply hyperlink

Related Articles


Please enter your comment!
Please enter your name here

Latest Articles