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

Max Samukha <maxsamu...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxsamu...@gmail.com

--- Comment #3 from Max Samukha <maxsamu...@gmail.com> ---
(In reply to Steven Schveighoffer from comment #2)
> (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.

In 'alias', they are just two equivalent ways of referencing 'x', that is:

__traits(isSame, S.x, T.s.x) == true

And it kind of makes sense if you think of 'alias' as little more than a means
of creating synonyms for a symbol. With 's.x' in the 'alias' declaration, you
are simply importing 'x' to the namespace of 'T'. Not that I care much now, but
some code I wrote actually relied on this semantics.

--

Reply via email to