[Issue 16123] alias member of member

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jun 6 08:11:17 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16123

--- Comment #2 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Sobirari Muhomori from comment #1)

> struct T
> {
>    S s;
>    alias y = S.x; // what this means?
> }

Right, but I said s.x, not S.x. It means alias to the member x of the instance
of S called s, which resides in this instance of T.

Maybe it's more helpful if I say:

alias y = T.s.x;

In any case, I see no technical limitation of why this shouldn't work. If
there's already a way to do it, please close and let me know how to!

Note, I've worked around in my code by doing essentially:

private ref y() { return s.x; }

But I much prefer the alias mechanism.

--


More information about the Digitalmars-d-bugs mailing list