digitalmars.D - alias this question
- Olli Aalto (6/6) Feb 13 2011 I encountered a problem with alias this, when the aliased member is
- Simen kjaeraas (9/14) Feb 13 2011 This is intended. alias this (and any other alias) act as simple
- Olli Aalto (4/15) Feb 13 2011 Pity. Would have been nice, now it's just one pretty useless feature at
- spir (11/16) Feb 13 2011 Dunno, lets me wonder: what are use cases of alias this on a public memb...
- Christopher Nicholson-Sauls (8/18) Feb 16 2011 There is actually an alternative, but I believe I remember it being said
- Jacob Carlborg (4/22) Feb 17 2011 Isn't opDot deprecated in favor of opDispatch?
- spir (7/31) Feb 17 2011 I personly need opDot, to customize member access ; not (only) method ca...
- Jacob Carlborg (5/33) Feb 17 2011 I'm pretty sure that you can use the getter/setter syntax with
- Simen kjaeraas (5/7) Feb 17 2011 You can only use one of the two, and yes, the bug is already
I encountered a problem with alias this, when the aliased member is private. I'm using the latest dmd2. It reports the follwing: src\main.d(14): Error: struct K.K member s is not accessible If I change the private modifier on the s member to public it works. Is this as intended, or a bug? O.
Feb 13 2011
Olli Aalto <oaalto gmail.com> wrote:I encountered a problem with alias this, when the aliased member is private. I'm using the latest dmd2. It reports the follwing: src\main.d(14): Error: struct K.K member s is not accessible If I change the private modifier on the s member to public it works. Is this as intended, or a bug?This is intended. alias this (and any other alias) act as simple rewrites to the aliased symbol, and does not change their protection level. certainly does describe it in general. http://d.puremagic.com/issues/show_bug.cgi?id=4533 -- Simen
Feb 13 2011
On 13.2.2011 19:40, Simen kjaeraas wrote:Olli Aalto <oaalto gmail.com> wrote:Pity. Would have been nice, now it's just one pretty useless feature at the end of a list of features for the language. O.I encountered a problem with alias this, when the aliased member is private. I'm using the latest dmd2. It reports the follwing: src\main.d(14): Error: struct K.K member s is not accessible If I change the private modifier on the s member to public it works. Is this as intended, or a bug?This is intended. alias this (and any other alias) act as simple rewrites to the aliased symbol, and does not change their protection level.
Feb 13 2011
On 02/13/2011 05:30 PM, Olli Aalto wrote:I encountered a problem with alias this, when the aliased member is private. I'm using the latest dmd2. It reports the follwing: src\main.d(14): Error: struct K.K member s is not accessible If I change the private modifier on the s member to public it works. Is this as intended, or a bug?Dunno, lets me wonder: what are use cases of alias this on a public member? I mean, on a member that /must/ remain private. Then, it's just syntactic sugar, which is good, but why wrap it into an object? In my mind, the typical use case is precisely a wrapper struct around something that, so-to-say, "naturally" ends up private. Denis -- _________________ vita es estrany spir.wikidot.com
Feb 13 2011
On 02/13/11 10:30, Olli Aalto wrote:I encountered a problem with alias this, when the aliased member is private. I'm using the latest dmd2. It reports the follwing: src\main.d(14): Error: struct K.K member s is not accessible If I change the private modifier on the s member to public it works. Is this as intended, or a bug? O.There is actually an alternative, but I believe I remember it being said that this would go away. In the meantime, I think it still works and maybe it could be saved. The alternative is to define a method opDot() which returns the entity to forward the call to. Check out std.typecons:Unique for an example. -- Chris N-S
Feb 16 2011
On 2011-02-16 20:42, Christopher Nicholson-Sauls wrote:On 02/13/11 10:30, Olli Aalto wrote:Isn't opDot deprecated in favor of opDispatch? -- /Jacob CarlborgI encountered a problem with alias this, when the aliased member is private. I'm using the latest dmd2. It reports the follwing: src\main.d(14): Error: struct K.K member s is not accessible If I change the private modifier on the s member to public it works. Is this as intended, or a bug? O.There is actually an alternative, but I believe I remember it being said that this would go away. In the meantime, I think it still works and maybe it could be saved. The alternative is to define a method opDot() which returns the entity to forward the call to. Check out std.typecons:Unique for an example. -- Chris N-S
Feb 17 2011
On 02/17/2011 11:41 AM, Jacob Carlborg wrote:On 2011-02-16 20:42, Christopher Nicholson-Sauls wrote:I personly need opDot, to customize member access ; not (only) method call. Denis -- _________________ vita es estrany spir.wikidot.comOn 02/13/11 10:30, Olli Aalto wrote:Isn't opDot deprecated in favor of opDispatch?I encountered a problem with alias this, when the aliased member is private. I'm using the latest dmd2. It reports the follwing: src\main.d(14): Error: struct K.K member s is not accessible If I change the private modifier on the s member to public it works. Is this as intended, or a bug? O.There is actually an alternative, but I believe I remember it being said that this would go away. In the meantime, I think it still works and maybe it could be saved. The alternative is to define a method opDot() which returns the entity to forward the call to. Check out std.typecons:Unique for an example. -- Chris N-S
Feb 17 2011
On 2011-02-17 11:54, spir wrote:On 02/17/2011 11:41 AM, Jacob Carlborg wrote:I'm pretty sure that you can use the getter/setter syntax with opDispatch, anything else is a bug. -- /Jacob CarlborgOn 2011-02-16 20:42, Christopher Nicholson-Sauls wrote:I personly need opDot, to customize member access ; not (only) method call. DenisOn 02/13/11 10:30, Olli Aalto wrote:Isn't opDot deprecated in favor of opDispatch?I encountered a problem with alias this, when the aliased member is private. I'm using the latest dmd2. It reports the follwing: src\main.d(14): Error: struct K.K member s is not accessible If I change the private modifier on the s member to public it works. Is this as intended, or a bug? O.There is actually an alternative, but I believe I remember it being said that this would go away. In the meantime, I think it still works and maybe it could be saved. The alternative is to define a method opDot() which returns the entity to forward the call to. Check out std.typecons:Unique for an example. -- Chris N-S
Feb 17 2011
Jacob Carlborg <doob me.com> wrote:I'm pretty sure that you can use the getter/setter syntax with opDispatch, anything else is a bug.You can only use one of the two, and yes, the bug is already filed. -- Simen
Feb 17 2011