From: Yukihiro Matsumoto Date: 2009-06-02T07:07:34+09:00 Subject: [ruby-core:23662] Re: [Bug #1550] String#lstrip! raises RuntimeError on Frozen String Despite Making No Changes Hi, In message "Re: [ruby-core:23657] [Bug #1550] String#lstrip! raises RuntimeError on Frozen String Despite Making No Changes" on Mon, 1 Jun 2009 20:13:49 +0900, Run Paint Run Run writes: |Calling String#lstrip! on a frozen string raises a RuntimeError even if the string was not changed. String#rstrip! doesn't raise an exception in this scenario. I believe that the latter behaviour is correct; #lstrip! should only raise a RuntimeError if the string would be changed. I admit the inconsistency. There could be two policies: (a) methods should raise RuntimeError only when actual changes are made, because it should detect changes. (b) methods should eagerly raise RuntimeError when they could possibly make changes, to detect modify attempt to frozen strings (that most likely caused by bugs) earlier. Currently both policies mixed. You've suggested the former, I'd rather prefer the latter. Any opinion? matz.