Here is a simplified version of real code I tried to write using getSymbolsByUDA:
import std.traits;
enum Runnable;
struct SubSystem
{
void run();
}
struct Manager
{
@Runnable SubSystem subsystem;
void run()
{
static foreach(system; getSymbolsByUDA!(Manager, Runnable))
{
system.run();
}
}
}
void main()
{
Manager m;
m.run();
}
Result:
onlineapp.d(16): Error: value of `this` is not known at compile time
This seems to be the most logical and straight-forward way to write this code. Whether it's due to a bug in the getSymbolsByUDA implementation, a bug in DMD, or a limitation in the language, it's my personal opinion this code should compile and "just work".
At the VERY LEAST the error message should be more helpful to the user on how to get the desired functionality.
Comment #1 by robert.schadek — 2024-12-01T16:39:54Z