From: Gavin Kistner Date: 2005-06-03T07:48:45+09:00 Subject: Re: Implementing a Read-Only array On Jun 2, 2005, at 11:22 AM, Brian Schr�der wrote: > Just playing devils advocate here, but if you care about user added > methods, the user may also add something that acts in effekt like > > class Array > def mutate(i, v) > self[i] = v > end > end Duly noted and understood. However...if I've undef'd #[]=, then that won't work, right? irb(main):003:0> class Array; def mutate(i,v); self[i]=v; end; end irb(main):004:0> a = [] irb(main):005:0> class << a; undef_method( :'[]=' ); end irb(main):008:0> a[0] = 0 NoMethodError: undefined method `[]=' for []:Array from (irb):8 irb(main):009:0> a.mutate(0,0) NoMethodError: undefined method `[]=' for []:Array from (irb):2:in `mutate' from (irb):9