Is it possible to generate unique fields and members with
recursive template mixins?
Each mixin has their own scope even if outer scope shadows their
scope. So could it be possible to generate template methods that
can access members in their own scopes? Assuming the members are
dispatches to unique aliases of static functions, methods
accessing fields of unique types of both structs and classes.
Basically my use case would be something of the nature of the
following (ofc I haven't gotten this working so it is mix of
pseudo code and some bits of real D):
alias Data = AliasSeq!(POD1,POD2,POD3/*etc*/); //List of
processed data types
alias Callables =
AliasSeq!(AliasSeq!(function,another),someClass,SomeStruct);
//processors
Processor!(Data,Callables) dataProcessor;
dataProcessor.simulate!float(1.5f);
class SomeClass(Callables)
{
recursive mixin?
}
Processor(alias Data, alias Callables)
{
SomeClass!Callables processors;
void simulate(parameterType...)(parameterType param)
{
foreach(callable; Callables)
{
static if(/* if right parameters */)
{
//Generate calls to each applicable processor
processors!callable(param);
}
}
}
}
If this is completely impossible with recursive mixin templates,
is there another feasible solution for my use case beyond manual
writing?