Synopsys 13 mentions an "is commutative" trait in its discussion of
operator overloading syntax:
> Binary operators may be declared as commutative:
>
> multi sub infix:<+> (Us $us, Them $them) is commutative {
> myadd($us,$them) }
A few questions:
Is this restricted to only binary operators, or can I tag any
function/method with the trait. The semantics would be that the current
seq of ordered args to the function would be treated as a true
(unordered) set for purposes of matching
Does the fact that a match was obtained by reordering the arguments
affect the distance metric of MMD?
Will the use of this trait catch errors such as the statement "class
quaternion does Num" that came up a few days ago on this list
(multiplication of quaternions isn't commutative; but of Nums is).
Does the trait only apply within one region of the arglist, or can I
create a 1-arg method that is commutative between the "self" arg and its
data arg? (I assume not -- I can't quite work out what that would mean)