From: "trans. (T. Onoma)" Date: 2005-01-18T22:44:55+09:00 Subject: Re: Problems with Passive Arguments and refactoring On Tuesday 18 January 2005 06:02 am, Esteban Manchado Vel叩zquez wrote: | Hi T, | | On Tue, Jan 18, 2005 at 11:09:16AM +0900, trans. (T. Onoma) wrote: | > [...] | > | > | Some hours later, I realized I had _not_ changed a couple of method | > | calls, so the method was receiving undefined arguments, and doing some | > | silly random thing until it crashed. | > | > [...] | > Not that you don't have a point. You do. But a number of things would | > catch errors "earlier" too, like static typing for example. | | Yes, but I don't find parameter number checking slows you down, while | static typing obviously does (at least in the short term). Okay, maybe a little. I don't think it slows people down too much. But I take your point. OTOH, having to use *args can slow one down too. | And I simply don't see the _advantage_ of not checking. If you need a | variable arguments method, simply declare it as that. The advantages are 1) greater polymorphism and 2) when doing AOP-style wrapping of multiple methods. | Also, IMHO if you push the dynamic philosophy too much, it stops being | practical, because you put too much of a burden in the programmer (why the | _need_ of testing for almost anything?). My _personal_ balance is having | the language do things like parameter number checking, but allow more | dynamic behaviour in other things (like parameter type checking). Sure. That's a fair opinion. But, in this case at least, I'm not of that opinion. I look at it as simple matter of duck quaking. For instance if I have: class A def a(x) "#{x}" end end class B def a(x,y) "#{x}#{y}" end end class C def puta(n,x,y) puts n.a(x,y) end end C.new.puta(B.new,"1","2") #=> 12 C.new.puta(A.new,"1","2") #=> Error I don't think A#a should blow-up here --which it will. And to fix it one has to either put in a _dummy_ y parameter or use the less friendly *args. Wouldn't a special togglable warning be enough to catch'em if you did want to work this way? OTOH, mayb being able to simply specify a method as parameter-indeterminate, like: def *a(x,y) end Might do as well. T.