ts wrote: >>>>>>"G" == George Moschovitis <george.moschovitis / gmail.com> writes: > > G> however, I would like to use it carefully. My question was: is this > G> possible? > > Well, you can use #instance_method and #bind but ruby will make the test > > uln% ruby -e 'Array.instance_method(:[]).bind(Hash.new)' > -e:1:in `bind': bind argument must be an instance of Array (TypeError) Note that EvilRuby has a less strict version of UnboundMethod#bind (#force_bind) which will work in this case: class Foo def x() end end class Bar end Foo.instance_method(:x).bind(Bar.new) # raises TypeError Foo.instance_method(:x).force_bind(Bar.new) # works Hash.instance_method(:[]).force_bind(Array.new) # still doesn't work