On Tue, May 17, 2005 at 09:04:19PM +0800, Autrijus Tang wrote: : Imagine: : : pugs> '1.28' * '2.56' : 3.2768 : : What is (or should be) going on here here? : : [1] role NumRole { : method infix:<*> returns Num (NumRole $x, NumRole $y: ) { ... } : } : Str.does(NumRole); : : [2] multi sub infix:<*> (Str $x, Str $y) returns Num { ... } : : [3] multi sub prefix:<+> (Str $x) returns Num { ... } : multi sub infix:<*> (Num $x, Num $y) returns Num { ... } : multi sub infix:<*> (Any $x, Any $y) returns Num { +$x * +$y } : : [4] multi sub infix:<*> (Num $x, Num $y) returns Num { +$x * +$y } : # ...and the MMD dispatcher forces incompatible type into : # the type with shared ancestors and closest distance... : : [5] none of the above -- that should be a type error. ;) : : [6] something else?
I tend to think of it most like [3], but it's possible that it's the same as [1] if the role is supplying the coercion assumed in [3]. Larry