From: "nobu (Nobuyoshi Nakada) via ruby-core" Date: 2026-07-10T05:45:32+00:00 Subject: [ruby-core:126031] [Ruby Feature#22137] Change `Symbol#to_s` to return frozen strings Issue #22137 has been updated by nobu (Nobuyoshi Nakada). I'd suggest to rename `STR_CHILLED_LITERAL` as `STR_CHILLED` simply. We shouldn't introduce any more ad-hoc flags such `_TO_S`. ---------------------------------------- Feature #22137: Change `Symbol#to_s` to return frozen strings https://bugs.ruby-lang.org/issues/22137#change-118011 * Author: byroot (Jean Boussier) * Status: Open ---------------------------------------- Since Ruby 3.4 ([Feature #20350]) `Symbol#to_s` returns a chilled string, meaning mutating it emits a deprecation warning. I believe it's now time to act on this deprecation, I'd like to request that on Ruby 4.1, `Symbol#to_s` always return a frozen string. Several very large codebases include Shopify and GitHub have been running with `Symbol.alias_method(:to_s, :name)` without any compatibility issues whatsoever. Making this change would allow to progressively get rid of an annoying pattern in performance sensitive code: ```ruby arg.is_a?(Symbol) ? arg.name : arg.to_s ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/