From: matz@... (Yukihiro Matsumoto) Date: 2000-04-20T16:41:33+09:00 Subject: [ruby-talk:02525] Re: frozen behavior Hi, In message "[ruby-talk:02522] Re: frozen behavior" on 00/04/20, Dave Thomas writes: |> It's intended behavior. I consider defining singleton method to |> frozen object should be prohibited, because I think it is kind of |> modification. | |I don't think I agree, but I'm sure I missing some subtlety. | |1. There's no change to the _state_ of an object if you add a method | to it, so you're not violating the freeze. I feel set of individual (singleton) methods of an object is included in the state of the object. |2. Why allow | | a = "Dave" | a.freeze | | class String | def xxx | end | end | a.xxx | | but not | | a = "Dave" | a.freeze | def a.xxx | end Hmm, I kinda feel like changing String class is altering the global status. But the result is almost same as you mentioned. matz.