Re: Is this a bug when creating proxies in classes?

2014-10-16 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 25 August 2014 at 18:10:33 UTC, Gary Willoughby wrote: class Foo { private int foo; mixin Proxy!(foo); this(int x) { this.foo = x; } } Apparently Proxy

Re: Is this a bug when creating proxies in classes?

2014-08-28 Thread Gary Willoughby via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 20:41:47 UTC, Marc Schütz wrote: On Tuesday, 26 August 2014 at 18:13:52 UTC, Gary Willoughby wrote: With that in mind what is strange is that if in my example you change the class for a struct everything works as expected. Why is that? This is bizarre... I tried

Re: Is this a bug when creating proxies in classes?

2014-08-28 Thread anonymous via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 18:13:52 UTC, Gary Willoughby wrote: With that in mind what is strange is that if in my example you change the class for a struct everything works as expected. Why is that? That's because when not mixed into a class, Proxy did import std.traits: static if

Re: Is this a bug when creating proxies in classes?

2014-08-28 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 28 August 2014 at 16:23:48 UTC, anonymous wrote: On Tuesday, 26 August 2014 at 18:13:52 UTC, Gary Willoughby wrote: With that in mind what is strange is that if in my example you change the class for a struct everything works as expected. Why is that? That's because when not

Re: Is this a bug when creating proxies in classes?

2014-08-26 Thread Gary Willoughby via Digitalmars-d-learn
On Monday, 25 August 2014 at 21:14:42 UTC, Ali Çehreli wrote: On 08/25/2014 12:17 PM, Marc Schütz schue...@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

Re: Is this a bug when creating proxies in classes?

2014-08-26 Thread via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 18:13:52 UTC, Gary Willoughby wrote: With that in mind what is strange is that if in my example you change the class for a struct everything works as expected. Why is that? This is bizarre... I tried a few things, but I have no idea. At first I thought the

Is this a bug when creating proxies in classes?

2014-08-25 Thread Gary Willoughby via Digitalmars-d-learn
Compiling the following code: import std.typecons; class Foo { private int foo; mixin Proxy!(foo); this(int x) { this.foo = x; } } void main()

Re: Is this a bug when creating proxies in classes?

2014-08-25 Thread Ali Çehreli via Digitalmars-d-learn
On 08/25/2014 11:10 AM, Gary Willoughby wrote: Compiling the following code: import std.typecons; class Foo { private int foo; mixin Proxy!(foo); this(int x) { this.foo = x; } } void main() { }

Re: Is this a bug when creating proxies in classes?

2014-08-25 Thread via Digitalmars-d-learn
On Monday, 25 August 2014 at 18:10:33 UTC, Gary Willoughby wrote: :!rdmd --force -de -debug -w test.d /usr/include/dmd/phobos/std/typecons.d(4043): Error: template instance isArray!(typeof(a)) template 'isArray' is not defined test.d(7): Error: mixin test.Foo.Proxy!(foo) error instantiating

Re: Is this a bug when creating proxies in classes?

2014-08-25 Thread Ali Çehreli via Digitalmars-d-learn
On 08/25/2014 11:38 AM, Marc Schütz schue...@gmx.net wrote: On Monday, 25 August 2014 at 18:10:33 UTC, Gary Willoughby wrote: :!rdmd --force -de -debug -w test.d /usr/include/dmd/phobos/std/typecons.d(4043): Error: template instance isArray!(typeof(a)) template 'isArray' is not defined

Re: Is this a bug when creating proxies in classes?

2014-08-25 Thread via Digitalmars-d-learn
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!

Re: Is this a bug when creating proxies in classes?

2014-08-25 Thread via Digitalmars-d-learn
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

Re: Is this a bug when creating proxies in classes?

2014-08-25 Thread Ali Çehreli via Digitalmars-d-learn
On 08/25/2014 12:17 PM, Marc Schütz schue...@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