From: merch-redmine@... Date: 2020-08-05T20:25:13+00:00 Subject: [ruby-core:99487] [Ruby master Misc#17104] Why are interpolated string literals frozen? Issue #17104 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Closed Other people have felt the same way, including me (see https://bugs.ruby-lang.org/issues/11473#note-7 and https://bugs.ruby-lang.org/issues/8976#note-67). However, @matz decided during the November 2015 developer meeting that they should be frozen for simplicity, see https://docs.google.com/document/d/1D0Eo5N7NE_unIySOKG9lVj_eyXf66BQPM4PKp7NvMyQ/pub ---------------------------------------- Misc #17104: Why are interpolated string literals frozen? https://bugs.ruby-lang.org/issues/17104#change-86943 * Author: bughit (bug hit) * Status: Closed * Priority: Normal ---------------------------------------- ```rb #frozen_string_literal: true def foo(str) "#{str}" end fr1 = 'a' fr2 = 'a' fr1_1 = foo(fr1) fr2_1 = foo(fr2) puts fr1.__id__, fr2.__id__, fr1_1.__id__, fr2_1.__id__ puts fr1_1 << 'b' ``` Isn't the point of frozen literals to avoid needless allocations? But interpolated strings are allocated each time, so freezing appears pointless. -- https://bugs.ruby-lang.org/ Unsubscribe: