[#79532] Immutable Strings vs Symbols — Daniel Ferreira <subtileos@...>

Hi,

15 messages 2017/02/15

[ruby-core:79766] Re: [Ruby trunk Feature#13077] [PATCH] introduce String#fstring method

From: Eric Wong <normalperson@...>
Date: 2017-02-25 02:11:20 UTC
List: ruby-core #79766
eregontp@gmail.com wrote:
> Eric Wong wrote:
> >  Anyways, committed as r57698
> 
> This should have a NEWS entry and tests since it changes the semantics.

Sorry, I forgot; will do.  Thanks for the reminder.

> BTW, should my_string.freeze behave similarly to String#@-?
> Otherwise String#freeze only dedup if the String is a literal.
> Always deduping for String#freeze would make the semantics more consistent.

No.  There is existing code which assumes #freeze always returns
the same object as its caller.  Changing #freeze will break
existing code.

We can only cheat with String literals (opt_str_freeze) because
literals are not assigned to user-visible variables, yet.

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next