Issue #11473 has been updated by Martin Drst.


Robert A. Heiler wrote:

>     _ = ''
>     _ << 'Hello '
>     _ << 'World!'
> 
> feels cleaner to me than this variant:
> 
>     _ = ''.dup
>     _ << 'Hello '
>     _ << 'World!'

One way to write this would be

_ = ''
_ += 'Hello '
_ << 'World!'

However, in a more complicated context, it may not be easy to know when thefirst change to the empty string occurs (assuming that using += in all cases is less efficient).


----------------------------------------
Feature #11473: Immutable String literal in Ruby 3
https://bugs.ruby-lang.org/issues/11473#change-54191

* Author: Koichi Sasada
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
Matz said "All String literals are immutable (frozen) on Ruby 3".

This ticket is place holder to discuss about that.




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