← Back to context

Comment by teddyh

3 days ago

TIL that Ruby has mutable strings, and (until the announced change) even had them mutable by default (and the change only affects literal strings; non-literal strings are still mutable). Python has always only ever had immutable strings.

In Ruby you tend to use :symbol for small immutable strings

<< is inplace append operator for strings/arrays, while + is used to make copy. So += will make new string & rebind variable

Strings are going to keep being mutable by default. Only strings created by string literals won't be.

Strings will still be mutable by default after the change which only makes string literals always frozen (which has been a file-level opt-in for a while.)

just dont ask about unicode