alias this question

Christopher Nicholson-Sauls ibisbasenji at gmail.com
Wed Feb 16 11:42:35 PST 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


More information about the Digitalmars-d mailing list