rafaqz / Mixers.jl

Julia mixin macros. Mixed, not stirred
Other
38 stars 3 forks source link

Could @Premix and @mix be linked to an abstract type? #12

Open Lincoln-Hannah opened 2 years ago

Lincoln-Hannah commented 2 years ago

Someithing like:

abstract type Drink

@premix @with_kw struct Fruitjuice{P,B}     {link to Drink}
    pommegranite::P
    orange::B
end

@mix @with_kw struct Soda{J}                {link to Drink}
    soda::J = 2u"L"
end

So that

struct Punch{L} <: Drink
    vodka::L
end

would be equivalent to

@Fruitjuice @Soda struct Punch{L} 
    vodka::L
end

Sorry If I've misunderstood the proper usage.

rafaqz commented 2 years ago

No... mixins can be combined and Julia doesn't have multiple inheritance.