Is this a bug when creating proxies in classes?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 25 14:14:42 PDT 2014


On 08/25/2014 12:17 PM, "Marc Schütz" <schuetzm at gmx.net>" wrote:
> On Monday, 25 August 2014 at 19:12:48 UTC, Marc Schütz wrote:
>> On Monday, 25 August 2014 at 18:44:36 UTC, Ali Çehreli wrote:
>>> It can be explained if the mixed-in template is evaluated at the
>>> mixin context without bringing in the imported modules to that
>>> context. I don't know whether it is true or whether it is a known
>>> limitation.
>>
>> You're right, that's it! It works when I import std.traits first.
>>
>> So... the fix is to import std.traits inside template Proxy. Going to
>> submit a PR.
>
> https://github.com/D-Programming-Language/phobos/pull/2463

Thanks! And I learned from you in the pull request the following fact:

<quote>
Quoting http://dlang.org/template-mixin :
"Unlike a template instantiation, a template mixin's body is evaluated 
within the scope where the mixin appears, not where the template 
declaration is defined. It is analogous to cutting and pasting the body 
of the template into the location of the mixin."
</quote>

Ali



More information about the Digitalmars-d-learn mailing list