private with alias this

evilrat evilrat666 at gmail.com
Mon Dec 24 23:06:39 PST 2012


On Tuesday, 25 December 2012 at 06:19:02 UTC, r_m_r wrote:
> i dunno. i'm no D expert either ;-)
>
> BTW its interesting that while the following assertion fails at 
> runtime:
>
> assert(!__traits(compiles, b.bar_));
>
>
> the assertion below executes without errors (as expected):
>
> assert(!__traits(compiles, b.bar_ == 20));
>
>
> regards,
> r_m_r

if it's in the same module than it's valid, code in one module 
can access private stuff within the module, so i think TS may put 
"private alias bar this" and call it from another module, in this 
case it's behaves correctly as the definition hidden by private 
modifier.


More information about the Digitalmars-d-learn mailing list