Alias for multiple mixins / traits

Hello everyone! What is the best way to give an alias for multiple mixed-in traits and group them? For example, I’d want to write something like this:

type NounAttributes = HasDeclensionTypeAndSubtype with HasStressType with HasStem with IsPartOfSpeech with HasSyntacticAndMorphologicalCharacteristics with HasInitialForm with HasGender with HasAnimacy

type NounFormAttributes = HasNumber with HasCase with HasStress

class NounForm private[Noun]() extends NounAttributes with NounFormAttributes { ... }

instead of:

class NounForm private[Noun]() extends
    //noun attributes
    HasDeclensionTypeAndSubtype with HasStressType with HasStem with IsPartOfSpeech
    with HasSyntacticAndMorphologicalCharacteristics with HasInitialForm with HasGender with HasAnimacy
    //noun form attributes
    with HasNumber with HasCase with HasStress { ... }

One solution that came to my head is to define an empty trait in the Noun class like this:

private[Noun] trait NounFormAttributes extends HasNumber with HasCase with HasStress

and use it instead, but I don’t like it and can’t understand why the ‘type’ keyword doesn’t work in this case.

Thank you in advance!

What is wrong with the trait? That is exactly what you want.

The type keyword doesn’t work, because you can not extend a type, but a class or a trait.

Because in this case it doesn’t add any behavior aspects and serves only for grouping. It doesn’t even work as a marker interface. I hoped that there is a way to make the ‘type’ keyword work because all I need is to give an alternative high-level descriptive name for a group of traits for more readability. But maybe this is too much of perfectionism. :slightly_smiling_face:

Yes it does, it is the behavior of all the other behaviors mixed together.