[#99426] [Ruby master Bug#17098] Float#negative? reports negative zero as not negative — chris@...

Issue #17098 has been reported by chrisseaton (Chris Seaton).

12 messages 2020/08/01

[#99449] [Ruby master Bug#17100] Ractor: a proposal for new concurrent abstraction without thread-safety issues — ko1@...

Issue #17100 has been reported by ko1 (Koichi Sasada).

41 messages 2020/08/03

[#99474] [Ruby master Feature#17103] Add a :since option to ObjectSpace.dump_all — jean.boussier@...

Issue #17103 has been reported by byroot (Jean Boussier).

9 messages 2020/08/04

[#99485] [Ruby master Misc#17104] Why are interpolated string literals frozen? — bughitgithub@...

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

23 messages 2020/08/05

[#99499] [Ruby master Bug#17105] A single `return` can return to two different places in a proc inside a lambda inside a method — eregontp@...

Issue #17105 has been reported by Eregon (Benoit Daloze).

10 messages 2020/08/06

[#99582] [Ruby master Feature#17122] Add category to Warning#warn — eileencodes@...

Issue #17122 has been reported by eileencodes (Eileen Uchitelle).

20 messages 2020/08/13

[#99700] [Ruby master Bug#17129] bundle install `eventmachine` and `sassc` fails since 914b2208ab3eddec478cdc3e079e6c30d0f0892c — yasuo.honda@...

SXNzdWUgIzE3MTI5IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IHlhaG9uZGEgKFlhc3VvIEhvbmRhKS4N

9 messages 2020/08/26

[ruby-core:99551] [Ruby master Feature#17104] Do not freeze interpolated strings when using frozen-string-literal

From: duerst@...
Date: 2020-08-11 06:22:28 UTC
List: ruby-core #99551
Issue #17104 has been updated by duerst (Martin D=FCrst).


bughit (bug hit) wrote in #note-11:
> > However in my view what defines a literal, is the use of a specific syn=
tax, so ""
> =

> There is only one reason for freezing literals, to be able to intern them=
 and reduce allocation. In fact the feature is poorly named, after the cons=
equence(freezing), not the cause (interning).

My understanding is that another reason is avoidance of alias effects. It's=
 easy to write code that when cut down to the essential, does this:
```
a =3D b =3D "My string"
a.gsub!(/My/, 'Your')
```
and expects `b` to still be "My string". Freezing makes sure this throws an=
 error.

(This is not an argument for or againts freezing interpolated strings.)


----------------------------------------
Feature #17104: Do not freeze interpolated strings when using frozen-string=
-literal
https://bugs.ruby-lang.org/issues/17104#change-87013

* Author: bughit (bug hit)
* Status: Open
* Priority: Normal
----------------------------------------
```rb
#frozen_string_literal: true

def foo(str)
  "#{str}"
end

fr1 =3D 'a'
fr2 =3D 'a'
fr1_1 =3D foo(fr1)
fr2_1 =3D 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 inter=
polated strings are allocated each time, so freezing appears pointless. =





-- =

https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread