: 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);
: [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 }
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].
I like #3, because it doesn't have any nasty implications to the type calculus.
I don't really have the theoretical or practical knowledge to really be able to back this up, but I have a strong hunch that value-based type shifting is the type system equivalent of $&.
Sam.
