On Sunday, February 16, 2025 12:38:09 AM MDT Anonymouse via Digitalmars-d-learn
wrote:
> I want to get a reference to a parent function from inside a
> nested function. I need it for `getUDAs!(parentFunction,
> attribute)`.
>
> `__traits(parent, mixin(__FUNCTION__))` works inside the parent
> func
On Monday, March 17, 2025 6:28:19 PM MDT Jonathan M Davis via
Digitalmars-d-learn wrote:
> On Sunday, February 16, 2025 12:38:09 AM MDT Anonymouse via
> Digitalmars-d-learn wrote:
> > I want to get a reference to a parent function from inside a
> > nested function. I need it for `getUDAs!(parentF
On Sunday, 16 February 2025 at 07:38:09 UTC, Anonymouse wrote:
How can I make this work?
As a workaround, you can define a useless symbol and get the
parent of that.
```
module foo;
void bar(string s, int i)
{
assert(__FUNCTION__ == "foo.bar");
alias parentModule = __traits(parent, m
I want to get a reference to a parent function from inside a
nested function. I need it for `getUDAs!(parentFunction,
attribute)`.
`__traits(parent, mixin(__FUNCTION__))` works inside the parent
function and gives me the module, but `mixin(__FUNCTION__)` alone
inside the nested function immed