From: Florian Frank Date: 2008-03-01T09:12:07+09:00 Subject: Re: Monkeypatching is Destroying Ruby Robert Dober schrieb: >> > I'd be at least a little interested in potentially offering developers >> > the chance to 'lock' their classes from monkey patches. >> >> There are probably ways around this, but: >> > Hmm I do not think that one can overrule freeze; I never found a way, > anyone else? > main>> class A; end # => nil main>> A.freeze # => A main>> class A; def foo;end ;end TypeError: can't modify frozen class from (irb):8 main>> A = A.dup (irb):9: warning: already initialized constant A # => A main>> class A; def foo;end ;end # => nil This doesn't work, if $SAFE == 4, though.