On Monday, 11 June 2018 at 13:47:41 UTC, Luís Marques wrote:
On Monday, 11 June 2018 at 13:39:22 UTC, Basile B. wrote:
the FQN is working here but i find the first message a bit confuse. Not sure if this small runnable represents the issue ?


---
module runnable;

import std.stdio, std.traits;

struct foo {  struct bar { static int baz;} }

template Test(alias arg)
{
    pragma(msg, fullyQualifiedName!arg);
}

void main()
{
    alias t = Test!(foo.bar.baz); // runnable.foo.bar.baz
}

That gets the types foo, bar, baz. I wanted the identifiers. Something like this:

struct Parent
{
    Son son;
}

struct Son
{
    int value;
}

void main()
{
    Parent parent;
alias t = Magic!(parent.son); // t is now parent (not Parent)
}

thanks that's clear now... it's indeed not possible

---
module runnable;

import std.stdio, std.traits;

struct Foo {struct Bar{static int baz;} Bar bar;}
Foo foo;

template Test(alias arg)
{
    // challenge: get "foo.bar.baz" here...
}

void main()
{
    alias t = Test!(foo.bar.baz);
}
---

Maybe something with opDispatch but it sounds complicated at first glance.

Reply via email to