alias this question

Jacob Carlborg doob at me.com
Thu Feb 17 07:05:06 PST 2011


On 2011-02-17 11:54, spir wrote:
> On 02/17/2011 11:41 AM, Jacob Carlborg wrote:
>> On 2011-02-16 20:42, Christopher Nicholson-Sauls wrote:
>>> 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
>>
>> Isn't opDot deprecated in favor of opDispatch?
>
> I personly need opDot, to customize member access ; not (only) method call.
>
> Denis

I'm pretty sure that you can use the getter/setter syntax with 
opDispatch, anything else is a bug.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list