This is just to clarify something from S13.
If I declare, for example
multi sub *infix:Â+Â (EvilNumber $lhs, EvilNumber $rhs) { ... }
Then if I run
my EvilNumber $a; my EvilNumber $b;
my EvilNumber $c = $a + $b;
I get my code, but
$a += $b;
Will attempt the default behaviour for +=, which is liable not to work. However, if I alter my operator overload to be
multi sub *infix:Â+Â (EvilNumber $lhs, EvilNumber $rhs) is deep { ... }
I get *infix:Â+=Â defined as { $lhs = $lhs + $rhs; } for free. Is that right?
Also, would things blow up if I specified the return types for operator overloads, such as
multi sub *infix:Â+Â (EvilNumber $lhs, EvilNumber $rhs) returns EvilNumber is deep { ... }
Would that work, would it behave strangely and what would it do to the definition of infix:Â+=Â which would be based on it? Is it even necessary? Does it give me anything? And can I overload based on return types?
Thanks
Matthew