ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:99485] [Ruby master Misc#17104] Why are interpolated string literals frozen?
@ 2020-08-05 20:06 bughitgithub
  2020-08-05 20:25 ` [ruby-core:99487] " merch-redmine
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: bughitgithub @ 2020-08-05 20:06 UTC (permalink / raw)
  To: ruby-core

Issue #17104 has been reported by bughit (bug hit).

----------------------------------------
Misc #17104: Why are interpolated string literals frozen?
https://bugs.ruby-lang.org/issues/17104

* Author: bughit (bug hit)
* Status: Open
* 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/

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-09-15 19:35 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05 20:06 [ruby-core:99485] [Ruby master Misc#17104] Why are interpolated string literals frozen? bughitgithub
2020-08-05 20:25 ` [ruby-core:99487] " merch-redmine
2020-08-05 20:58 ` [ruby-core:99488] " bughitgithub
2020-08-05 21:05 ` [ruby-core:99489] " merch-redmine
2020-08-05 21:10 ` [ruby-core:99490] " eregontp
2020-08-05 21:18 ` [ruby-core:99491] " bughitgithub
2020-08-05 21:26 ` [ruby-core:99492] [Ruby master Feature#17104] Do not freeze interpolated strings when using frozen-string-literal merch-redmine
2020-08-06  1:37 ` [ruby-core:99493] " daniel
2020-08-06  9:23 ` [ruby-core:99496] " jean.boussier
2020-08-06 10:12 ` [ruby-core:99497] " eregontp
2020-08-06 11:10 ` [ruby-core:99501] " jean.boussier
2020-08-10 18:51 ` [ruby-core:99546] " bughitgithub
2020-08-11  6:22 ` [ruby-core:99551] " duerst
2020-08-11 15:57 ` [ruby-core:99560] " bughitgithub
2020-08-26  7:43 ` [ruby-core:99699] " akr
2020-08-31  8:50 ` [ruby-core:99793] " matz
2020-08-31 19:28 ` [ruby-core:99802] " eregontp
2020-09-01 15:39 ` [ruby-core:99817] " mame
2020-09-01 18:18 ` [ruby-core:99822] " eregontp
2020-09-02 14:15 ` [ruby-core:99840] " nobu
2020-09-03  0:29 ` [ruby-core:99858] " ko1
2020-09-03 14:26 ` [ruby-core:99877] " eregontp
2020-09-15 19:35 ` [ruby-core:100015] " eregontp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).