On 5/4/06, Bill Kelly <billk / cts.com> wrote: > From: "Pat Maddox" <pergesu / gmail.com> > > > > Wouldn't it be a lot nicer to do > > > > class DontTouchMe > > include Freezable > > end > > > > to ensure that nobody messes around with it? > > Should we start by closing the String class, then? :) > > What sorts of classes do you think should be made closed? > > And why is the author of the class in the best position to > determine whether or not it should be open? > > irb(main):001:0> class String irb(main):002:1> def whee irb(main):003:2> "whee" irb(main):004:2> end irb(main):005:1> end => nil irb(main):006:0> "".whee => "whee" irb(main):007:0> String.freeze => String irb(main):008:0> class String irb(main):009:1> def yarr irb(main):010:2> "yarr" irb(main):011:2> end irb(main):012:1> end TypeError: can't modify frozen class from (irb):9 from :0 irb(main):013:0>