Issue #11782 has been updated by Rodrigo Rosenfeld Rosas.


how about splitting strings like this?

~~~
long_string = 'first part ' +
  'second part ' +
  'last part'
~~~

Should long_string be optimized by the compiler to generate 'first part second part last part' as a frozen string, or should it actually perform the additions and generate a modified string?

----------------------------------------
Feature #11782: String#+@ and String#-@
https://bugs.ruby-lang.org/issues/11782#change-55366

* Author: Koichi Sasada
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
Matz said 

> In fact, my best choice is introducing `String#+` that returns a mutable copy of a string.
[ruby-core:71879] [Ruby trunk - Bug #11759] 

So that this is a ticket for that.
I'll commit it ASAP to check this methods before 2.3.

Specification:

* `+'foo'` returns modifiable string.
* `-'foo'` returns frozen string (because wasters will freeze below 0 degree in Celsius).




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