> As I said, I wasn't sure whether or not I was being serious at this point. > > > > > method bar($x, $y) { > > > > method bar($z) { # note 1 > > > Oh, bringing in multimethods Just Isn't Fair. > > > > Those are multimethods? Migod, I feel like a person who's just > > discovered for the first time in their life that the plate that gets > > passed around in church is for putting money *onto*. > > Oh, if you have a method which does X when it gets one argument and does > Y when it gets another, I'd call that a multimethod. But then, I am no > OO wizard.
I would just call that overloading based on number of arguments A multimethod is a mehtod that is overloaded based on types of arguments. Moreover, the types of the arguments are based on the dynamic, not static, type. method foo( Derived1 $x, Derived2 $y ) { } method foo( Derived2 $x, Derived1 $y ) {} my Base $x = new Derived1; my Base $y = new Derived2; foo( $x, $y ); foo( $y, $x ); Since foo is a multimethod, the correct foo gets chosen each time, even though the static type of $x and $y is Base.