Project

General

Profile

Actions

Feature #9043

open

Add String#f method as shortcut for #freeze

Added by headius (Charles Nutter) over 10 years ago. Updated 13 days ago.

Status:
Assigned
Target version:
-
[ruby-core:57967]

Description

We have String#b to create a binary-encoded String, and we have the "f" suffix (going away, hopefully) and the "literal".freeze optimization (#8992). I think it would be reasonable to add String#f as a shorter method for producing a frozen string.

If String#f is added the "literal".freeze optimization could be dropped in favor of "literal".f. This would provide something very close to the original "literal"f syntax but in a backward-compatibility-friendly way (class String; alias f freeze; end).

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0