Mon, 11 Nov 2002 13:49:38 +0900, coma_killen@fastmail.fm coma_killen@fastmail.fm pisze:
My intuition would be that the knowledge that initialize
takes only 1 param would be known to the new method.
Why? I wouldn’t expect that foo’s arity is 3 here:
def foo(*args)
bar(*args)
end
def bar(x, y, z)
x+y+z
end
It’s the same with new and initialize.
Arity shouldn’t be relied upon, because forwarding calls to other
methods like here can lose this information. The concept of arity
formally doesn’t exist for me in a dynamically typed language; a
method may reject a particular number of arguments even if its own
header doesn’t declare that.
···
–
__("< Marcin Kowalczyk
__/ qrczak@knm.org.pl
^^ Blog człowieka poczciwego.