Hi,

I'm working with roles where the mixing-in classes and roles need to
have some mixin-specific notion of equality. So I have an Equality
role that can also be
mixed in as needed:

role Equality {
  method equal(Equality:D) of Bool:D {...}
}

To make using the role easier I've created an infix operator "=/=". To
give the infix operator predcitable semantics I need to specify the
precedence and the associativity with traits:

sub infix:<=/=>(Equality:D \x, Equality:D \y) of Bool:D is
equiv(&infix:<==>) is assoc<chain> is export {
  x.equal(y)
}

Is there some way to combine traits to a more succinct trait?  Something like:

subset Equivalence of Routine where {magic}...;

sub infix:<=/=>(Equality:D \x, Equality:D \y) of Bool:D is equivalence
is export;

Would a custom version of the trait_mod:<is> routine do the trick?

Reply via email to