Re: how to have alias this with an unaccessible member?

2013-05-23 Thread Timothee Cour
This won't do for the same reason: now 'get' is made public so we're back to the same problem (inverting roles of x and get). However what about changing the behavior of alias this as follows: when a member/method x is private, alias x this behaves as if x was not declared private. I think this

Re: how to have alias this with an unaccessible member?

2013-05-22 Thread timotheecour
On Sunday, 19 May 2013 at 14:33:32 UTC, Ali Çehreli wrote: On 05/19/2013 05:34 AM, Simen Kjaeraas wrote: Well, there is also opDot: What is the state of opDot? According to the change log, it has been introduced as a part of Version D 2.013 Apr 22, 2008 with the note Added opDot, which is

Re: how to have alias this with an unaccessible member?

2013-05-22 Thread Jonathan M Davis
On Wednesday, May 22, 2013 18:18:34 timotheecour wrote: On Sunday, 19 May 2013 at 14:33:32 UTC, Ali Çehreli wrote: On 05/19/2013 05:34 AM, Simen Kjaeraas wrote: Well, there is also opDot: What is the state of opDot? According to the change log, it has been introduced as a part of Version

Re: how to have alias this with an unaccessible member?

2013-05-22 Thread Timothee Cour
at least 'delete' is in the deprecated table (marked as will be deprecated some time in the future) so should opDot then. On Wed, May 22, 2013 at 11:34 AM, Jonathan M Davis jmdavisp...@gmx.comwrote: On Wednesday, May 22, 2013 18:18:34 timotheecour wrote: On Sunday, 19 May 2013 at 14:33:32

Re: how to have alias this with an unaccessible member?

2013-05-19 Thread Dicebot
On Saturday, 18 May 2013 at 00:12:13 UTC, Timothee Cour wrote: so in what you suggest, the exact same problem remains with 'get' being exposed instead of 'x', so the situation didn't improve... looks like it's impossible to achieve this? With current implementation of alias this - no. It

Re: how to have alias this with an unaccessible member?

2013-05-19 Thread Simen Kjaeraas
On Sat, 18 May 2013 02:12:00 +0200, Timothee Cour thelastmamm...@gmail.com wrote: so in what you suggest, the exact same problem remains with 'get' being exposed instead of 'x', so the situation didn't improve... looks like it's impossible to achieve this? Well, there is also opDot:

Re: how to have alias this with an unaccessible member?

2013-05-19 Thread Ali Çehreli
On 05/19/2013 05:34 AM, Simen Kjaeraas wrote: Well, there is also opDot: What is the state of opDot? According to the change log, it has been introduced as a part of Version D 2.013 Apr 22, 2008 with the note Added opDot, which is experimental only. I will keep assuming that opDot does not

Re: how to have alias this with an unaccessible member?

2013-05-19 Thread Namespace
On Sunday, 19 May 2013 at 14:33:32 UTC, Ali Çehreli wrote: On 05/19/2013 05:34 AM, Simen Kjaeraas wrote: Well, there is also opDot: What is the state of opDot? According to the change log, it has been introduced as a part of Version D 2.013 Apr 22, 2008 with the note Added opDot, which is

Re: how to have alias this with an unaccessible member?

2013-05-18 Thread Dicebot
Will this do? struct A(T) { private T x; ref T get() { return x; } alias get this; } -

Re: how to have alias this with an unaccessible member?

2013-05-18 Thread Dicebot
Btw, fun fact. This code crashes 2.063 beta: struct A(T) { private T x; alias y = x; alias y this; } dmd: aliasthis.c:114: virtual void AliasThis::semantic(Scope*): Assertion `t' failed.

how to have alias this with an unaccessible member?

2013-05-17 Thread Timothee Cour
How to have alias this with an unaccessible member (x below). Making the member private won't work as it'll disable all operations on said member. struct A(T){ T x; //private T x would prevent alias this from doing anything useful alias x this; } void main(){ auto a=A!int

Re: how to have alias this with an unaccessible member?

2013-05-17 Thread Simen Kjaeraas
On Sat, 18 May 2013 01:13:00 +0200, Timothee Cour thelastmamm...@gmail.com wrote: How to have alias this with an unaccessible member (x below). Making the member private won't work as it'll disable all operations on said member. struct A(T){ T x; //private T x would prevent alias

Re: how to have alias this with an unaccessible member?

2013-05-17 Thread Timothee Cour
, Timothee Cour thelastmamm...@gmail.com wrote: How to have alias this with an unaccessible member (x below). Making the member private won't work as it'll disable all operations on said member. struct A(T){ T x; //private T x would prevent alias this from doing anything useful