5 ms·
> There is a trade‐off here for them; as a general rule, such languages have immutable strings This is a bit disingenuous. I understand what he's aiming at, an
by Padding 12y ago
> There is a trade‐off here for them; as a general rule, such languages have immutable strings
This is a bit disingenuous. I understand what he's aiming at, and he also mentions StringBuilder later on, but saying that a GC necessatites immutable strings is simply not true.
As a counterexample: PHP has mutable strings and uses copy-on-write in situations where it "feels" that conflicts could occur. (Granted PHPs rules on how it handles its variables is a bit arbitrary and magical, and PHP didn't have a GC till version 5.3 .. but the argument still stands.)
- chrismorgan 12y agoYes, I know I was being rather fuzzy there. I was intending to give a general impression of where the differences lie.