matz / netlab.co.jp (Yukihiro Matsumoto) 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.

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


As I said, I'm sure I'm misunderstanding something.


Dave