static foreach and new identifier names
Adam D. Ruppe
destructionator at gmail.com
Fri Jan 5 22:25:22 UTC 2018
On Friday, 5 January 2018 at 18:36:52 UTC, H. S. Teoh wrote:
> What about my second idea of using a template to create new
> identifiers for intermediate declarations?
You're still using a nested scope, which is illegal outside a
function. Moreover, what I want to do is introduce functions
right here. Consider the following (pseudocode):
private @magic int foo_() { return 0; }
static foreach(func; getByUda!magic()) {
public int nameof!func[0 .. $-1]() {
return func();
}
}
The idea is to take a list of inputs - functions with the @magic
annotation - and create wrapper functions for them with the same
name, just without the tailing _.
(for one example)
More information about the Digitalmars-d
mailing list