Should defining singleton_method_added call itself?
This seems surprising:
obj = Object.new def obj.singleton_method_added(n) p n end def obj.new_singleton_method; end
Updated by jeremyevans0 (Jeremy Evans) 8 months ago
singleton_method_added is called after the method is added and not before, I think the current behavior makes sense and do not think it is the bug. The same behavior exists for
module A extend self def method_added(n) p n end end
Updated by Eregon (Benoit Daloze) 8 months ago
- Status changed from Open to Closed
Right, it makes sense with the current semantics.
I think this is surprising though, and possibly causing bugs for people expecting the method to be called only for methods defined after method_added/singleton_method_added.
However, since no one seems bothered too much, let's close this.