[#99868] [Ruby master Bug#17144] Tempfile.open { ... } does not unlink the file — eregontp@...
Issue #17144 has been reported by Eregon (Benoit Daloze).
15 messages
2020/09/03
[ruby-core:100015] [Ruby master Feature#17104] Do not freeze interpolated strings when using frozen-string-literal
From:
eregontp@...
Date:
2020-09-15 19:35:52 UTC
List:
ruby-core #100015
Issue #17104 has been updated by Eregon (Benoit Daloze).
I merged https://github.com/ruby/ruby/pull/3488 so it's in time for preview1.
@nobu Could you decide if you think https://github.com/nobu/ruby/tree/unfrozen-literal is worth it?
----------------------------------------
Feature #17104: Do not freeze interpolated strings when using frozen-string-literal
https://bugs.ruby-lang.org/issues/17104#change-87566
* Author: bughit (bug hit)
* Status: Closed
* Priority: Normal
* Assignee: Eregon (Benoit Daloze)
----------------------------------------
I think the point of frozen string literals is to avoid needless allocations. Interpolated strings are allocated each time, so freezing them appears pointless.
```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'
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>