From: ts Date: 2001-01-16T15:19:50+09:00 Subject: [ruby-talk:9363] Re: Redefining singleton methods & C - function pointers >>>>> "C" == Christoph Rippel writes: C> Nice - I definitely keep this one in my archive! It was just stolen from lib/delegate.rb C> You need to add a call to #super somewhere otherwise regular C> instance_methods are not mixed in. Yes, I've forgotten the call to #super C> The way your code handles arity is problematic - functions relying C> on argument separation like C> def A.s (left,*right) C> p left C> p right C> end C> won't work correctly. Why, I've not understood ? It call : #{name}.send(:#{method}, *args, &block) ruby just make an array of the arguments given to the function and then it verify arity before calling the def. In your example, it just verify that it has at least one argument. C> def X.s C> end C> p Y.singleton_methods # [] C> won't work. To do this you need to change the behavior of C> #method_added as well. Yes but in your example it's #singleton_method_added which must be defined. It was a simple example for redefining #append_features. Guy Decoux