https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112011-08-27T06:53:13ZRuby Issue Tracking SystemRuby master - Bug #5235: Ruby fails to freeze Strings and Numerics.https://bugs.ruby-lang.org/issues/5235?journal_id=204292011-08-27T06:53:13Zaprescott (Adam Prescott)
<ul></ul><p>This is not a bug. <code>x += 1</code> is sugar for <code>x = x + 1</code>, and x + 1 does not<br>
modify the receiver. Similar for <code>s += "a"</code>.</p>
<p>s = ""<br>
s.freeze<br>
s.replace("nothing") #=> RuntimeError: can't modify frozen string</p> Ruby master - Bug #5235: Ruby fails to freeze Strings and Numerics.https://bugs.ruby-lang.org/issues/5235?journal_id=204332011-08-27T08:50:40Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p>#freeze prohibits modification to an object, not a variable.</p>