From: Paul Brannan Date: 2001-10-24T06:21:03+09:00 Subject: [ruby-talk:23098] Re: Bruce Eckel's opinion of Ruby On Wed, 24 Oct 2001, Rich Kilmer wrote: > I realize it does not in the sense that overriding a method on class > Array will effect the entire interpreter, but in the sense that it > partitions symbols (variables, classes, modules, etc). > > Are you speeking here of an ability to actually change Array, but have > that change only be available to the originating "namespace" and > classes (or modules) defined within a "namespace" are only visible to > that "namespace"? Someone brought this up at the conference. Does this give the desired result? module Foo class Array < Array def []=(foo, bar) super(foo, bar) puts 'foo' end end def self.foo a = Array.new a[0] = 42 end foo end a = Array.new a[0] = 42 Paul