From: "trans. (T. Onoma)" Date: 2004-10-05T00:19:03+09:00 Subject: Re: Too Many Ways? On Monday 04 October 2004 10:55 am, David A. Black wrote: > I have to admit (and my lack of C++, Java, etc. is probably showing > through here -- i.e., I'm perfectly willing to believe there's > something fundamental I'm just missing), I have never understood the > idea of differentiating methods by number of arguments. To me it's > sort of like differentiating them based on what letters the argument > names begin with. What if two slightly different forms of the method > both, by chance, took three arguments? Would one add a dummy > argument? The whole thing has always seemed to me like a > gimmick/workaround for languages with design problems. > > (Again, all based on gut reaction and probably not enough > education....) My use case is this. I wrote an event-based AOP interface on top of set_trace_func. To define advice, one defines "hook" methods. Now, I could force the user to always define those methods with the full array of arguments: def my_advice(target, binding, back_binding) Or I can allow them to use none, the first, the first and second, or all three, as they require. i.e. def my_advice def my_advice(target) def my_advice(target, binding) def my_advice(target, binding, back_binding) I choose to allow the user this flexibility. Thank goodness there are only three! T.