I have those templates:
template some_template {
param some_param default false;
}
template another_template {
param some_param default false;
}
And I want to process templates like this:
param templates_to_work_with = [some_template, another_template];
in each (each in (templates_to_work_with)) {
param some_param = true;
}
Or, at least, like this:
param templates_to_work_with = [some_template, another_template];
method set_true() {
foreach tmpl in (templates_to_work_with) {
tmpl.some_param = true;
}
}
But I've got compilation error obviously:
In templates_to_work_with
error: unknown identifier: 'some_template'
How can I get through it? Any ways to make this processing in dml?
Templates are not values or even expressions, so cannot be part of parameters.
I suppose your use case is that
in each ... { param some_param = true; }
is part of a library, andparam templates_to_work_with = [...];
belongs to the user of that library? If so, then I think the best your library can do is:and then let the user say: