Re: Combining multiple "is..." traits into one?

2020-08-11 Thread yary
I played with the "is" trait and I is puzzled. This example code multi trait_mod: (Routine \routine, :$equality!) { trait_mod:(routine, :equiv(:<==>)); } sub is-eq is equality { ... } say 'is-eq ', multi trait_mod: (Routine \routine, :$chainable!) { trait_mod:(routine, :assoc); }

Re: Combining multiple "is..." traits into one?

2020-08-11 Thread Stuart Hungerford
On Wed, Aug 12, 2020 at 8:12 AM Tobias Boege wrote: > [...] > > Would a custom version of the trait_mod: routine do the trick? > > Yes: > > multi trait_mod: (Routine $r, :$equivalence!) { > trait_mod:($r, :equiv(:<==>)); > trait_mod:($r, :assoc); > } As a supplementary question:

Re: Combining multiple "is..." traits into one?

2020-08-11 Thread Larry Wall
On Wed, Aug 12, 2020 at 12:12:34AM +0200, Tobias Boege wrote: : I have no idea if this attribute or the format : for the 'prec' key in particular are standardized. The whole point of providing equiv/tighter/looser was to avoid standardizing absolute precedence levels. That being said, I don't

Re: Combining multiple "is..." traits into one?

2020-08-11 Thread Stuart Hungerford
On Wed, Aug 12, 2020 at 8:12 AM Tobias Boege wrote: > > 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

Re: Combining multiple "is..." traits into one?

2020-08-11 Thread Tobias Boege
On Wed, 12 Aug 2020, Stuart Hungerford wrote: > 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

Combining multiple "is..." traits into one?

2020-08-11 Thread Stuart Hungerford
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